Script

FTP

The professional tool to automate FTP, SFTP, FTPS

and schedule FTP batch jobs

Syntax:

CLOSEHOST()

Remarks:

As this command does not accept any parameters the parenthesis are optional.

Return value:

CLOSEHOST will return “OK” if the connection has been closed 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:

OPENHOST

Examples:

# Connect to ftp.myhost.com as myuser and download all the files
OPENHOST("ftp.myhost.com","myuser","mypassword")
GETFILE("*.*")
CLOSEHOST
# Connect to ftp.funet.fi anonymously, download README
# and then upload it to ftp.myhost.com
 
# The file will be downloaded to the Windows temp directory
LOCALCHDIR("C:\WINDOWS\TEMP")
 
OPENHOST("ftp.funet.fi")
GETFILE("README")
CLOSEHOST
 
OPENHOST("ftp.myhost.com","myuser","mypassword")
 
PUTFILE("README")
CLOSEHOST
 
# Delete the downloaded README file
EXEC("del README")