Script

FTP

The professional tool to automate FTP, SFTP, FTPS

and schedule FTP batch jobs

update_web.ftp

Use this script to update a website. It uses the SYNC command to synchronize the contents of the remote site from a local directory. This means that ScriptFTP will upload only the new or modified files.

# The host, user name and password are stored in variables.
# Change the text between the quotes with your own settings.
$hostname="ftp.host.com"
$user="myuser"
$password="mypassword"
 
# Variables are also used to store the local and remote path
# of the website.
$localwebfolder="C:\LocalWebFolder\"
$remotewebfolder="/"
 
# Connect to the FTP server. Variables are used as OPENHOST parameters.
OPENHOST($hostname,$user,$password)
 
# Upload the new or modified files. Subdirectories are ignored.
SYNC($localwebfolder,$remotewebfolder,UPLOAD)
 
# Close the connection
CLOSEHOST