Using a Script to Download a File

The script below connects to the GlobalSCAPE FTP site and downloads a file called index.txt to two local folders; c:/temp1 and c:/temp2.

 

Set MySite = CreateObject("CuteFTPPro.TEConnection")

MySite.Host = "ftp.globalscape.com"

MySite.Connect 'Recommended: call connect first

'next line changes to a predetermined folder so I can use a relative path in the download method

MySite.RemoteFolder = "/pub/cuteftp"

MySite.LocalFolder = "c:\temp1"

MsgBox (MySite.RemoteFolder) 'display current remote folder

MySite.Download "index.txt"

MySite.Download "index.txt", "c:\temp2\index.txt"

'now verify that it downloaded okay

If MySite.LocalExists ("c:\temp1\index.txt") Then

MsgBox "File1 downloaded OK."

End If

If MySite.LocalExists ("c:\temp2\index.txt") Then

MsgBox "File2 downloaded OK."

End If

MsgBox "Done"

MySite.Disconnect

MySite.Close

Related Topics

Connecting to a Remote Server (Connect)

Downloading Files (Download)

Finding a Method Alphabetically

Finding a Method by Category

Finding a Property Alphabetically

Finding a Property by Category