How to write FTP scripts

FTPScript is a powerful, yet simple scripting language specifically for FTP, FTPS and SFTP.
Command overview
Most commands are fairly self explanatory, and are described in the script command reference.
The set command is used to set various parameters that are used during the session, such as username, password, timeout and so on. Many of these parameters are optional (e.g. port, timeout). The most important parameter is the protocol.
Various macros can be inserted into the script at execute time.
The local working directory may be set in the process trigger definition inside the CompleteFTP Manager, or it may be set using the localdir command inside the script. All uploads and downloads that do not specify a full path, will use the set local working directory.
Sample code
A sample script is shown below:

# Sample SFTP script for uploading a file to another server
set remotehost=otherftpserver.com
set user=myusername
set password=mypassword
set protocol=sftp

# connect to the server
open

# upload the file for which the trigger occurred to the server
# note quotes around path as it may contain spaces
put "%WindowsPath%" %FileName%

# disconnect
close