For information about Globalscape, visit www.globalscape.com. |
Use the Download method to transfer a file or folder from a remote location to your local hard drive.
Syntax
Object.Download (BSTR strRemoteName ,BSTR strLocalName , long nMultiPartNumber)
Parameters
strLocalName |
This is optional. Use this only if you want to change the destination name or path for the downloaded files or folder. You can use absolute or relative paths. |
strRemoteName |
This is the path to the remote item you are downloading. You can use absolute or relative paths with or without wildcards. |
nMultiPartNumber |
Use this to split the download into multiple parts. The default value = 1. The value specifies the number of parts used for the download. |
Example
Set MySite = CreateObject("CuteFTPPro.TEConnection")
'Specify user, pass, host, and connect as normal...
MySite.Connect 'Recommended: call connect first
'next line changes to a predetermined folder so you can use a relative path in the download method
MySite.RemoteFolder = "/c:/Inetpub/ftproot/Temp/Temp/"
MsgBox (MySite.RemoteFolder) 'display current remote folder
MySite.Download "agent.ini", "c:\temp\agent1.ini"
'now verify downloaded ok
If CBool(MySite.LocalExists ("c:\temp\agent1.ini")) Then
MsgBox "File downloaded OK."
End If
Configuration Notes:
Setting the Multi-part download attribute can greatly increase the transfer speed for larger files under certain conditions. For example, the site must support multiple concurrent connections from the same user and you must have significant bandwidth.
The Download method is a synchronous command, meaning it must finish executing before subsequent commands in your script can be called. Use the method DownloadAsync (which also supports Multi-part transfers) to asynchronously download files, which allows you to execute the rest of the script while the download(s) take place.
You cannot download and rename multiple files by specifying a wildcard in the strLocalName parameter. For example, MySite.Download "*.exe", "*.txt" will download all of the files in the current remote folder that end with *.exe to a local folder named "_.txt". That is, if you specify a wildcard, the wildcard character is replaced by an underscore ( _ ) character.