<< back to sysax.com Product page

1.4. Strings, numbers, variables and lists

A string is any group of characters enclosed in quotes. Strings may also contain wildcards such as * and ?. A number is any value between 0 and 2^32.

A variable is represented by a ~ character followed by alphanumeric or underscore characters. A variable may contain either string or numerical values and will be treated as a string or number depending on the context in which it is used. A variable is automatically created and initialized to an empty string at the point of first use. Protected variables may be used to hide passwords and other strings. The contents of a protected variable will be automatically decrypted when the variable is passed to the ftpconnect* group of commands, the certload command or the pkeyload command. In all other cases, including printing of the variable, only the encrypted value is made available. The encrypted string for a protected variable should be generated from the command line using the -protectstring option.

Exhibit 1.3. Examples for using the strings, numbers, and variables in script

"this is a string" #string

45 #number

~my_variable #variable

A list is represented by a @ character followed by alphanumeric or underscore characters. Lists represent the contents of a folder and can contain zero or more items. Each item represents a specific file or folder. Lists can be set using the ftpgetlist command and each item in a list can be accessed using the foreach loop. Two lists can be compared using the listcompare command. The contents of an entire list or a single list item can be appended to another list using the listappend command. Each list also contains the following property:

.count     number of items contained in the list

Each list item is represented by a $ character followed by alphanumeric or underscore characters and contains the following properties:

.name        file or folder name string
.isfolder    flag set to false for file and true for folder
.size        size of the file in bytes
.modtime     modification time string in YYYYMMDDhhmmss format (Y=year, M=month, D=day, h=hour, m=minute, s=second)

Exhibit 1.4. Example for using the lists in script

@my_list #list

@my_list.count  #count property of a list

$list_item #list item

$list_item.size #size property of list item