file_sync.ftp

This script shows how to use the ScriptFTP file synchronization capabilities using the SYNC command.

# Connect to ftp.myhost.com as myuser
OPENHOST("ftp.myhost.com","myuser","123456")
  
# Download all the modified and new files from the directory
# /MyRemoteDir located in the FTP site to the local
# directory C:\MyLocalDir. Subdirectories are ignored.
SYNC("C:\MyLocalDir","/MyRemoteDir",DOWNLOAD)
 
# Download all the modified and new files from the directory
# /MyRemoteDir located in the FTP site to the local
# directory C:\MyLocalDir. Subdirectories are included 
# in the synchronization.
SYNC("C:\MyLocalDir","/MyRemoteDir",DOWNLOAD,SUBDIRS)
 
# Download all the modified and new jpg files from the directory
# /MyRemoteDir located in the FTP site to the local
# directory C:\MyLocalDir. Subdirectories are included 
# in the synchronization.
SYNC("C:\MyLocalDir","/MyRemoteDir",DOWNLOAD,SUBDIRS,"*.jpg")
 
# Upload all the modified and new files from the local
# directory C:\MyLocalDir to the directory /MyRemoteDir
# located in the FTP site Subdirectories are included 
# in the synchronization.
SYNC("C:\MyLocalDir","/MyRemoteDir",UPLOAD,SUBDIRS)
 
 
# SYNC can also delete the files and directories that no longer
# exist:
 
# Upload all the modified and new files from the local
# directory C:\MyLocalDir to the directory /MyRemoteDir
# located in the FTP site Subdirectories are included 
# in the synchronization. Remote files and directories that
# do not exist in the local side are deleted.
SYNC("C:\MyLocalDir","/MyRemoteDir",UPLOAD_DELETE,SUBDIRS)
 
 
# Download all the modified and files from the directory
# /MyRemoteDir located in the FTP site to the local
# directory C:\MyLocalDir. Subdirectories are not included 
# in the synchronization. Local files that do not exist
# in the remote side are deleted.
SYNC("C:\MyLocalDir","/MyRemoteDir",DOWNLOAD_DELETE)
 
 
# Close the connection
CLOSEHOST