Jump to content

Recommended Posts

Posted

hello there,

am trying to import some files to a local direcotry from an ftp server

am using the following code

conn is an INet control

i added the lcd command because i noticed that on ftp (run from command prompt) the mget puts the files in the directory where ftp was run from, so

when i change the local current directory it will put them there.

but my code isn't working. if anyone can test it and try to figure out what's wrong with it. thanks

ps: i know there are api functions for ftp commands, but i prefer using Inet.

Private Sub cmd_ImportFiles_Click()
conn.URL = "ftp://user:password@192.168.0.1"

Me.StatusBar.SimpleText = "Connected to Ftp."
ftp_src_dir = "Alfa/Beta/"
ftp_dest_dir = App.Path

conn.Execute conn.URL, "lcd " & ftp_dest_dir
While conn.StillExecuting: DoEvents: Wend

conn.Execute conn.URL, "MGET " & ftp_src_dir & "*"
While conn.StillExecuting: DoEvents: Wend

MsgBox "end"
End Sub


Posted

i replaced it with

   conn.Execute conn.URL, "CD " & ftp_src_dir
   While conn.StillExecuting: DoEvents: Wend
   
   conn.Execute conn.URL, "DIR "
   While conn.StillExecuting: DoEvents: Wend
   
   zFileList = conn.GetChunk(4096, 0)
   zFiles = Split(zFileList, vbCrLf)
   i = 0
   
   While (i < UBound(zFiles) - 1)
         conn.Execute conn.URL, "GET " & zFiles(i) & " " & ftp_dest_dir & "\"& zFiles(i)
   wend

it actually suits me better for my prog, but still it would be insteresting to know how to MGET the files

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...