Transfer scripts

Instruction syntax

The Transfer instructions field of a transfer script can contain two different things:

The transfer instruction list is a CSV file with the following mandatory columns: Action, Source, Destination and Flags.

Path types

To understand the Source and Destination, here are the three types of values that they can take:

A file path always identifies a single file (but not a folder). It can be absolute (begins with / and traces the location of the file or folder from the root of the file tree) or relative (does not begin with / and traces the location from the local or remote root specified in the transfer script configuration). It must not end with a /.

A file path pattern is formatted like a file path, but contains at least one * character. It matches all files such that the complete path of the file fits the pattern, where * can be replaced by zero, one or more characters other than /. Note that all glob patterns are not supported: no ** or ? are allowed. For example, if a file /root/folder/file.csv exists:

Pattern Matches?
/root/folder/*.csv yes
/root/*/file.csv yes
/root/fol*/file.csv yes
/root/*.csv no
/*/file.csv no
/**/file.csv invalid

A folder path is formatted like a file path, but ends with /. It always identifies a single folder (but not a file).

Note that folder path patterns (containing * but ending with /) are not supported.

The Destination must be a file path or a folder path. The Source is a file path, file path pattern or recursive path.

The Action column determines the meaning of each line, and how the Source and Destination are interpreted.

GET

GET will retrieve all files that match Source on the remote server, and download them to the Destination in the local file tree. The exact behavior depends on the nature of Source and Destination. The allowed combinations are:

Note that if there are no files or folders on the remote server that match Source, then this instruction will fail and report an error, unless the optional flag is provided.

PUT

PUT will select all files that match Source in the local file tree, and upload them to the Destination on the remote server. The exact behavior depends on the nature of Source and Destination. The allowed combinations are:

Note that if there are no files or folders in the local file tree that match Source, then this instruction will fail, unless the optional flag is provided.

DELETE

DELETE ignores the Destination, and will remove all files matched by Source on the remote server.

Action, Source,           Destination, Flags
DELETE, /single/file.csv, ,
DELETE, /multi/*.csv,     ,
DELETE, /recurse/folder/  , 

This will delete the remote file /single/file.csv, then all files with a .csv extension in remote folder /multi/, then the remote folder /recurse/folder/ and all its contents.

Note that if there are no files or folders on the remote server that match Source, then this instruction will fail, unless the optional flag is provided.

LIST

LIST expects Source to be a folder path the remote server, and will list the names of all the files (but not sub-folders) directly within that folder. The list is formatted as a CSV file and is then written to the path Destination in the local file tree.

Action, Source,           Destination,     Flags
LIST,   /path/to/folder/, /local/list.csv,

This lists all the files (but not sub-folders) of remote folder /path/to/folder/ into a CSV file, written to the local file /local/list.csv

Note that if the Source folder does not exist on the remote, then this instruction will fail, unless the optional flag is provided. If the optional flag is provided, then an empty CSV file is produced.

MOVE

MOVE will move a file or folder identifed by Source on the remote server so that its new path is Destination, still on the remote server. The main purpose of this instruction is to allow the files to be uploaded (slowly) to a temporary location, and then moved (instantly) to their final location. The exact behavior depends on the nature of Source and Destination. The allowed combinations are:

Note that if there are no files or folders on the remote server that match Source, then this instruction will fail, unless the optional flag is provided.

Flags

The Flags column contains a comma-separated set of case-insensitive flags with the following meanings:

User Contributed Notes
0 notes + add a note