File Transfer Script Language
The File Transfer Script Language is a very basic scripting language that allows you to automate routine file transfer processes. This language may be used when defining a File Transfer Script action as part of trigger.
The following commands may be used in a script file when invoking File Transfer Command Line.
append "<file>" ["<destination>"]
lcopy "<path>" "<destination>"
lmove "<path>" "<destination>"
lrename "<path>" "<destination>"
prompt <variablename> "<prompt>"
promptmask <variablename> "<prompt>"
put "<file>" ["<destination>"]
rename "<path>" "<destination>"
set aftpcompressionfilesize <filesize>
set aftpcompressionexclude "<filter>"
set aftpcongestioncontrol <boolean>
set aftpdownloadrate <bitrate>
The above commands are reserved words in the FTCL language and may not be used as variable names when using the set
or prompt
commands.
Examples
Bad example: prompt dir "Enter directory name: "
The variable named "dir"
may not be used as this is a reserved word for use by the "dir"
command used to get a directory listing.
Good example: prompt mydir "Enter directory name: "
The variable named "mydir"
is not a reserved word so may be used.
Appends contents of local file to remote file with same name.
<file>
a quoted relative filename or absolute path
<destination>
optional quoted remote filename to append to
Example
append "log.txt" "mylog.txt"
Example
append "log.txt" |
||
Sets directory on remote server.
<directory>
a quoted relative directory name or absolute path
Example
cd "jsmith"
Example
cd "/home/users/jsmith" |
||
Establishes connection with remote server. |
||
Deletes remote filename.
<file>
a quoted relative filename or absolute path
Example
del "logs.txt"
Example
del "/home/user/logs.txt" |
||
Deletes remote directory recursively
<directory>
a quoted relative directory name or absolute path
Example
deldir "logs"
Example
deldir "/home/users/jsmith/logs" |
||
Disconnects from remote server. |
||
Executes command on local machine.
<command>
valid command to be interpreted by the local operating system.
Example
exec "dir c:/tmp > c:/tmp/dirout.txt"
See also
|
||
Downloads file from remote server.
<file>
a quoted relative filename or absolute path
Example
get "logs.txt" |
||
Downloads directory recursively from remote server.
<directory>
a quoted relative directory name or absolute path
Example
getdir "logs"
Example
getdir "/var/logs" |
||
Sets current working directory on local machine. This directory is used when uploading files using relative paths and when downloading files.
<directory>
a quoted absolute path
Example
lcd "c:/tmp"
See also
|
||
Copies a local file to a local destination.
<path>
a quoted relative or absolute file or directory path
<destination>
a quoted relative or absolute file or directory path
Example
lcopy "logs.txt" "logs.txt.old"
Example
lcopy "c:/tmp/logs.txt" "c:/tmp/logs.txt.old"
See also
|
||
Deletes local filename.
<file>
a quoted relative filename or absolute path
Example
ldel "logs.txt"
Example
ldel "c:/tmp/logs.txt"
See also
|
||
Deletes local directory recursively
<directory>
a quoted relative directory name or absolute path
Example
ldeldir "tmp"
Example
ldeldir "c:/tmp"
See also
|
||
Creates local directory recursively
<directory>
a quoted relative directory name or absolute path
Example
lmkdir "tmp"
Example
lmkdir "c:/tmp"
See also
|
||
Moves a local file to a local destination.
<path>
a quoted relative or absolute file or directory path
<destination>
a quoted relative or absolute file or directory path
Example
move "logs.txt" "archive/logs.txt"
Example
move "c:/tmp/logs.txt" "c:/tmp/archive/logs.txt"
See also
|
||
Renames file on local machine.
<path>
a quoted relative or absolute file or directory path
<destination>
a quoted relative or absolute file or directory path
Example
lrename "logs.txt" "logs.txt.old"
Example
lrename "c:/tmp/logs.txt" "c:/tmp/logs.txt.old"
See also
|
||
Downloads files from current remote directory matching filter.
<filter>
a quoted regular expression
Example
mget ".*\\.txt" |
||
Creates directory on remote server.
<directory>
a quoted relative directory name or absolute path
Example
cd "jsmith"
Example
cd "/home/users/jsmith" |
||
Sets transfer mode to ASCII or binary.
<mode>
a quoted transfer mode of "ascii" or "binary"
Example
mode "ascii" |
||
Uploads local files in current working directory matching filter to remote server.
<filter>
a quoted regular expression
Example
mput ".*\\.txt" |
||
Sends message to current debugging stream. By default the console is the current debug stream and debugging is enabled.
Example
msg "connecting to FTP server" |
||
Prompts user to enter a value to be read from the command line and stores this value in the variable name used in the first argument. The value stored in this variable is then available for use later in the script.
Example
prompt username "Enter username: " |
||
Prompts user to enter a value to be read from the command line and stores this value in the variable name used in the first argument. The value stored in this variable is then available for use later in the script. Value entered is masked to user.
Example
promptmask password "Enter password: " |
||
Uploads local file to remote server.
<file>
a quoted relative filename or absolute path
<destination>
optional quoted remote filename or absolute path to store file as
Example
put "c:/tmp/logs.txt"
Example
put "c:/tmp/logs.txt" "mylogs.txt"
See also
|
||
Uploads local directory recursively to remote server.
<directory>
a quoted relative directory name or absolute path
Example
putdir "logs"
Example
putdir "c:/tmp/logs"
See also
|
||
Renames file on remote server.
<path>
a quoted relative or absolute file or directory path
<destination>
a quoted relative or absolute file or directory path
Example
rename "logs.txt" "logs.txt.old"
Example
rename "/var/logs/logs.txt" "/var/logs/logs.txt.old" |
||
Creates a user defined variable for use within a script.
<variablename>
A variable name used to reference the variable. Must begin with a letter, and may be followed by 0 or more letters or digits.
<value>
The value the variable name represents. Valid values include boolean values of true or false, any valid integer or any quoted string.
Example
set myNumberVariable 12
Example
set myBooleanVariable true
Example
set myStringVariable "testing 1.2.3"
Variables created may later be referenced using the ${<variablename>} notation.
Example
set myNumberVariable 12
msg "value of myNumberVariable is: {myNumberVariable}" |
||
Specifies whether streaming compression is enabled or disabled in AFTP connections. By default compression is enabled.
<boolean>
true, false
Example
set aftpcompression false |
||
|
||
Specifies a case-insensitive, comma-delimited list of file extensions to exclude when using compression in AFTP connections. Default value is:
".bz2,.F,.gz,.lz,.lzma,.lzo,.rz,.sfark,.xz,.z,.Z,.infl,.7z,.s7z,.ace,.afa,.alz,.apk,.arc,.arj,.ba,.bh,.cab,.cfs,.cpt,.dar,.dd,.dgc,.dmg,.gca,.ha,.hki,.ice,.j,.kgb,.lzh,.lha,.lzx,.pak,.partimg,.paq6,.paq7,.paq8,.pea,.pim,.pit,.qda,.rar,.rk,.sda,.sea,.sen,.sfx,.sit,.sitx,.sqx,.tgz,.tbz2,.tlz,.uc,.uc0,.uc2,.ucn,.ur2,.ue2,.uca,.uha,.wim,.xar,.xp3,.yz1,.zip,.zipx,.zoo,.zz,"
<filter>
a comma-delimited list of file extensions.
Example
set aftpcompressionexclude ".zip,.gz" |
||
Specifies whether congestion control is enabled or disabled when connecting using AFTP protocol. By default congestion control is enabled.
<boolean>
true, false
Example
set aftpcongestioncontrol false |
||
Specifies the download rate in Kbits per second. The default rate is 45000 Kbps.
<bitrate>
A valid integer between 1-2,147,483,647
Example
set aftpdownloadrate 100000 |
||
Specifies whether credentials and/or data are protected during an AFTP session. Default value is "none" providing no protection.
<mode>
a valid security mode. Valid values are "none", "credentials & data", "credentials only".
Example
set aftpsecurity "credentials only" |
||
Specifies the upload rate in Kbits per second. The default rate is 45000 Kbps.
<bitrate>
A valid integer between 1-2,147,483,647
Example
set aftpdownloadrate 100000 |
||
Specifies whether debugging is enabled or disabled. By default debugging is enabled and all debugging information is sent to the console.
<boolean>
true, false
Example
set debug false |
||
Specified the hostname of the remote server.
<hostname>
a valid quoted hostname or IP address
Example
set hostname "192.168.10.2" |
||
Specifies the path of the log file to write debug data to. By default all output is sent to the console.
<file>
a valid relative or absolute file path on local machine
Example
set logfile "c:/tmp/log.txt"
See also
|
||
Specifies whether passive or active mode should be used in FTP/S protocols. Default is true.
<boolean>
true, false
Example
set passive true |
||
Specifies the password to use when logging into the remote server.
<password>
a valid quoted password for specified username on remote server
Example
set password "secret" |
||
Specifies the protocol to use when establishing a connection.
<protocol>
the protocol to use. Valid options are "ftp", "ftps", "ftps-auth-tls", "ftps-auth-ssl", "ftps-implicit", "sftp" and "aftp" for the protocols FTP, FTP over SSL (AUTH SSL), FTP over SSL (Implicit SSL), SFTP (FTP over SSH) and AFTP respectively. Default protocol is "ftp"
Note
When using "ftps-implicit" setting you must set the port to the server port responsible for handling implicit SSL connections. This is typically handled on port 990.
Example
set protocol "ftps-auth-tls"
See also
set port (below) |
||
Specifies the port of the remote server. The default ports for FTP and SFTP protocols are 21 and 22 respectively.
<port>
A valid integer between 1-65535
Example
set port 2021 |
||
Specifies the path of private key file to use when authenticating with SFTP server. Valid for use in SFTP protocol only.
<file>
a valid relative or absolute file path on local machine
Example
set privatekey "c:/ssh/keys/id_dsa" |
||
Specifies that the secure SFTP protocol be used. FTP protocol is used by default. Requires that SSH version 2.0 or above be installed on remote server and SFTP be enabled.
<boolean>
true, false
Example
set secure true |
||
Sets the maximum timeout used when establishing a connection, sending data or receiving data. If timeout is exceeded script will abort. Default value is 60 seconds.
<seconds>
the maximum number of seconds to wait
Example
set timeout 30 |
||
Specifies the username to use when logging into the remote server.
<username>
a valid quoted username for remote server
Example
set username "jsmith" |
||
Specifies the wire encoding to use on command channel for FTP/S protocols.
<encoding>
a valid quoted character encoding
Example
set wireencoding "UTF-8" |
||
Pauses execution of script for specified number of seconds.
<seconds>
the number of seconds to wait
Example
wait 5 |