Syntax:

GETFILE(file,SUBDIRS)

  • file: an individual file name or a wildcard expression for multiple files. The expression may include a remote directory, for example “/htdocs/*.gif”
  • SUBDIRS (optional): Download subdirectories.

Remarks:

This command will overwrite local files as needed.
Use LOCALCHDIR to set the current local directory before calling GETFILE. Files will be downloaded to that directory.
Use SETPASSIVE to disable passive transfer mode if you encounter firewall problems.
Use SETTYPE to change the data transfer type. Default is Binary (most common).
Use SYNC to download new or modified files only.

Return Value:

GETFILE will return “OK” if every file has been downloaded successfully.
If the operation fails it will return an error code. You may retrieve the return value and execute various operations depending on this value. See Error Handling.

See also:

SETPASSIVE
SETTYPE
PUTFILE
SYNC

Examples:

# Connect to ftp.myftp.com
OPENHOST("ftp.myftp.com","myuser","mypassword")
 
# Change current local directory
LOCALCHDIR("C:\dest_dir\excel_docs\")
 
# Download PriceList.xls
GETFILE("PriceList.xls")
 
# Change current local directory
LOCALCHDIR("C:\dest_dir\help/help/images\")
 
# Download all files from /images
GETFILE("/images/*.*")
 
# Change current local directory
LOCALCHDIR("C:\dest_dir\")
 
# Download all files and directories
# from the remote directory /stuff
GETFILE("/stuff/*.*",SUBDIRS)
 
# Close connection
CLOSEHOST