Script

FTP

The professional tool to automate FTP, SFTP, FTPS

and schedule FTP batch jobs

Variables.ftp

This scripts shows the basics of variables. It also uses IF to perform different actions depending on the OPENHOST result.

# Set some variables
$myftpserver="ftp.myhost.com"
$myuser="joe"
$mypassword="123456"
 
# Connect to the FTP server using
# the values stored in the variables.
# The value returned from OPENHOST is
# stored in the variable $resultvalue.
$resultvalue=OPENHOST($myftpserver,$myuser,$mypassword)
 
# If OPENHOST returned OK means that the connnection
# was successfull. In this case we download the file and
# close the connection, if not we show an error message.
IF($resultvalue=="OK")
 GETFILE("test.zip")
 CLOSEHOST
ELSE
 PRINT("Cannot connect to the FTP server.")
END IF