Using a Script to Download a File
The script below connects to the Globalscape FTP Site and downloads a file called index.txt to a local folder, c:/temp.
Copy
'This sample script performs an anonymous login to ftp://ftp.globalscape.net
'Get a reference to the TE COM object.
Dim MySite
Set MySite = CreateObject("CuteFTPPro.TEConnection")
MySite.Protocol = "FTP"
MySite.Host = "ftp.globalscape.com"
MySite.Login = "anonymous"
MySite.Password = "user@user.com"
MySite.UseProxy = "BOTH"
MySite.FileOverWriteMethod = "NUMERATE"
MySite.Connect
'Verify the connection was made successfully
If (Not Cbool(MySite.IsConnected)) Then
MsgBox "Could not connect to: " & MySite.Host & "!"
Quit(1)
End If
'The script will now check to see if the local folder c:\temp exists and will create it if necessary
If (Not (MySite.LocalExists("c:\temp"))) Then
MySite.CreateLocalFolder "c:\temp"
End If
'Change TE's local working folder to to c:\temp
MySite.LocalFolder = "c:\temp"
'Check for existence of remote folder "/pub/cuteftp"
b = MySite.RemoteExists("/pub/cuteftp/")
If (Not CBool(b)) Then
'Verify existence of remote folder
MsgBox "Remote folder not found!. Please make sure that the Pub folder exists on the remote Site"
Quit(1)
End If
'Now download the index file to the local destination folder
MySite.Download "/pub/cuteftp/index.txt"
'Complete. Show the status of this transfer.
MsgBox "File downloaded attempted. Status: '" + MySite.Status + "'"
MySite.Disconnect
MySite.Close