File Transfer Script Language

Top  Previous  Next

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 when writing file transfer scripts.

 

append

cd

connect

del

deldir

disconnect

get

getdir

lcd

lcopy

ldel

ldeldir

lmove

lrename

mget

mode

mput

msg

put

putdir

rename

set debug

set hostname

set logfile

set passive

set password

set protocol

set port

set privatekey

set timeout

set username

wait

 

 

append "{localfile}" ["{destination}"]

Appends contents of local file to remote file with same name.

 

{localfile}

 

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"

cd "{directory}"

Sets directory on remote server.

 

{directory}

 

a quoted relative directory name or absolute path

 

Example

 

cd "jsmith"

 

Example

 

cd "/home/users/jsmith"

connect

Establishes connection with remote server.

del "{file}"

Deletes remote filename.

 

{file}

 

a quoted relative filename or absolute path

 

Example

 

del "logs.txt"

 

Example

 

del "/home/user/logs.txt"

deldir "{directory}"

Deletes remote directory recursively

 

{directory}

 

a quoted relative directory name or absolute path

 

Example

 

deldir "logs"

 

Example

 

deldir "/home/users/jsmith/logs"

disconnect

Disconnects from remote server.

get "{file}"

Downloads file from remote server.

 

{file}

 

a quoted relative filename or absolute path

 

Example

 

get "logs.txt"

getdir "{directory}"

Downloads directory recursively from remote server.

 

{directory}

 

a quoted relative directory name or absolute path

 

Example

 

getdir "logs"

 

Example

 

getdir "/var/logs"

lcd "{directory}"

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"

lcopy "{path}" "{destination}"

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"

ldel "{file}"

Deletes local filename.

 

{file}

 

a quoted relative filename or absolute path

 

Example

 

ldel "logs.txt"

 

Example

 

ldel "c:\tmp\logs.txt"

ldeldir "{directory}"

Deletes local directory recursively

 

{directory}

 

a quoted relative directory name or absolute path

 

Example

 

ldeldir "tmp"

 

Example

 

ldeldir "c:\tmp"

lmove "{path}" "{destination}"

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"

lrename "{path}" "{destination}"

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"

mget "{regex}"

Downloads files from current remote directory matching regular expression.

 

{regex}

 

a regular expression

 

Example

 

mget "*.\.txt"

mode "{mode}"

Sets transfer mode to ASCII or binary.

 

{mode}

 

a quoted transfer mode of "ascii" or "binary"

 

Example

 

mode "ascii"

mput "{regex}"

Uploads local files in current working directory matching regular expression to remote server.

 

{regex}

 

a regular expression

 

Example

 

mput "*.\.txt"

msg "{message}"

Sends message to current debugging stream. By default the console is the current debug stream and debugging is enabled.

 

{message}

 

the message to send

 

Example

 

msg "connecting to FTP server"

put "{file}" ["{destination}"]

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"

putdir "{directory}"

Uploads local directory recursively to remote server.

 

{directory}

 

a quoted relative directory name or absolute path

 

Example

 

putdir "logs"

 

Example

 

putdir "c:\tmp\logs"

 

rename "{path}" "{destination}"

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"

set debug {boolean}

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

set hostname "{hostname}"

Specified the hostname of the remote server.

 

{hostname}

 

a valid quoted hostname or IP address

 

Example

 

set hostname "192.168.10.2"

set logfile "{file}"

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"

set passive {boolean}

Specifies whether passive mode will be used when connecting with FTP/S protocols.

 

{boolean}

 

true, false

 

Example

 

set passive true

set password "{password}"

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"

set protocol "{protocol}"

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" and "sftp" for the protocols FTP, FTP over SSL (AUTH SSL), FTP over SSL (Implicit SSL) and SFTP (FTP over SSH) respectively. Default protocol is "ftp"

 

Example

 

set protocol "ftps-auth-tls"

set port {port}

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

set privatekey "{file}"

Specifies the path of private key file to use when authenticating with SFTP server. Valid for use in SFTP protocol (FTP over SSH) only.

 

{file}

 

a valid relative or absolute file path on local machine

 

Example

 

set privatekey "c:\ssh\keys\id_dsa"

set timeout {seconds}

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

set username {username}

Specifies the username to use when logging into the remote server.

 

{username}

 

a valid quoted username for remote server

 

Example

 

set username "jsmith"

wait {seconds}

Pauses execution of script for specified number of seconds.

 

{seconds}

 

the number of seconds to wait

 

Example

 

wait 5