Script

FTP

The professional tool to automate FTP, SFTP, FTPS and Batch FTP

Syntax:

LOCALCHDIR(path)

  • path: absolute or relative local path, e.g. C:\Users\John\Docs\ or John\Docs

Remarks:

Use LOCALCHDIR to set the current local directory before calling GETFILE. Files will be downloaded to that directory.

Return value:

LOCALCHDIR will return “OK” if ScriptFTP can access the remote directory.
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:

CHDIR
LOCALCWDIR
LOCALRMDIR
LOCALMKDIR

Examples:

# Connect to server
OPENHOST("ftp.myftp.com")
 
# Change the current local directory
# All files will now be downloaded here
LOCALCHDIR("C:\backup\web")
 
# Download files
GETFILE("web/*.*",SUBDIRS)
 
# Go to the parent directory
LOCALCHDIR("..")
 
# Download files
GETFILE("pricelist.xls")
 
# Close connection
CLOSEHOST