CrushMFT Documentation

Variables#

A variable is a name in braces that the server replaces with a value when the task runs: {name} becomes the name of the file in hand, {yyyy}{MM}{dd} today's date. Variables are what makes one task work for every file and every day.

A variable can be used in nearly every field of a task: addresses, file names, filters, the subject and text of a mail, a command, a condition.

file:///archive/{yyyy}/{MM}/{name}

copies each file into a folder for the year and month.

The file in hand#

A task works through its list one item at a time. These are about the item it is at:

Variable Is For sftp://files.example.com/in/report.2026.csv
{name} the file's name report.2026.csv
{stem} the name without its last ending report.2026
{ext} the ending, with its dot .csv
{path} the folder and name on that server /in/report.2026.csv
{parent_path} the folder /in/
{url} the whole address. A password in it is left out.
{parent_url} the address of the folder
{protocol} the kind of address sftp
{size}, {size_formatted} the size in bytes, and as "1.2 MB"
{type} FILE or DIR
{real_path}, {real_parent_path} for file:// items, the path as the operating system writes it
{md5} the file's checksum, where a task worked it out

Other tasks add values to an item, and those are variables too: see the page of each task. {all} is everything known about the item, for finding out what there is.

For a task that compares two lists, {url_2}, {real_path_2} and the like are about the second item.

The run#

Variable Is
{scheduleName}, {schedule_name} the job's name
{scheduleNote} the job's note
{job_id} the id of this run
{taskName} the name of the task that is running
{items_count}, {item_count} how many items the list has
{iteration} the count of tries, in a task that retries
{hostname} the name of the machine
{working_dir} the server's folder
{full_log} the log of this run so far, the last megabyte of it: for the mail that reports a failure

Errors#

Variable Is
{task_error} the error of the task that failed last
{task_errors} all errors of the run so far, one per line
{task_error_name} the name of the task that failed last
{task_error_names} the names of all tasks that failed, with commas

See When a job fails.

Loops#

Inside a Loop: {loop_index} (from 0), {loop_number} (from 1), {loop_total}, {loop_first}, {loop_last}, {loop_elapsed}. In a loop inside a loop, the outer loop's values are {loop_<name of the outer loop>_index} and so on.

Dates and times#

Variable Is Variable Is
{yyyy}, {yy} year {HH} hour, 0-23
{MM} month, 01-12 {hh} hour, 1-12
{MMM}, {MMMM} Nov, November {mm} minute
{dd} day {ss} second
{EEE}, {EEEE} Fri, Friday {S} millisecond
{D} day of the year {aa} AM or PM
{w}, {W} week of the year, of the month {z}, {Z} time zone, as a name and as +0100
{u} day of the week as a number {J} Julian date
{millis}, {time}, {now} the time as milliseconds {yesterday}, {tomorrow}, {daybeforeyesterday} those days as milliseconds

Mind upper and lower case: {MM} is the month and {mm} the minute.

A mark before or after the letters moves the date:

Written Means Example
{.MM} now {.yyyy}{.MM}{.dd}
{!MM} yesterday {!yyyy}{!MM}{!dd}
{.!MM} the day before yesterday
{!!MM} last week
{!!!MM} last month {!!!yyyy}-{!!!MM} for a monthly report
{MM!} tomorrow
{MM!!} next week
{MM!!!} next month
{-MM} the date the file was last changed {-yyyy}/{-MM}/{name} files by their own date
{MM_} when the transfer of the file began (events)
{_MM} when the transfer of the file ended (events)

{dateadd:5} in front moves the dates that follow by so many days: {dateadd:5}{.MM}{.dd}{.yyyy} is the date in five days; a negative number goes back.

The user of an event#

In a job that an event started, the user is known:

Variable Is
{user_name} the login name. For a name like an e-mail address, {user_name_at0} is the part before the @ and {user_name_at1} the part after.
{user_email}, {user_first_name}, {user_last_name}, {user_phone} from the user's account
{user_ip}, {user_protocol} where they came from, and how
{user_ any setting of the account }
{session_log} the log of the user's session, the last megabyte of it

Values the user typed themselves, into an upload form or a custom event's form, are {meta_ and the field's name }. They are kept apart from the server's own values on purpose: a user cannot overwrite {user_name} or an address by naming a form field so.

The server#

Variable Is
{server_ a value of the server's status } for example {server_version}
{customData_ name } a value from the server's custom data
{thread_dump} what every thread of the server is doing, for the support

Variables of your own#

The UserVariable task sets a variable: a name and a value. The value can be worked out with functions.

Name begins with Lives Seen by
anything else until the run ends this run
GLOBAL_ until the server is restarted every job
PERSIST_ for good: it is written to persistent_job_variables.XML every job, also after a restart

A counter that grows by one in every run is a PERSIST_ variable. A value handed from one job to the next is a GLOBAL_ one.

A variable set in one branch is seen in all others at once.

Special characters#

{r} is a carriage return, {n} a new line, {t} a tab: {name}{r}{n} in a WriteFile task writes one name per line.

The older spelling with percent signs, %name%, works wherever braces do.

A value is never a command#

What a variable brings in is data and stays data. A file that somebody names {full_log}.txt or {encrypt_start}… is handled under exactly that name: the braces in a value are never read as a variable or a function. Only what you typed into the task is.

What an admin with limited rights may use#

Variables that show the server's own paths and logs, the server's status, another user's data or a stored secret need a right of their own. A job saved by an admin who lacks it is refused at saving, with the name of the variable. See Who may see, change and run a job and Roles.

Every variable, by the alphabet#

Task variables is the index of all variables these pages describe, and Server variables lists those of the server itself.

Trying a variable#

POST /tests/job-variable of the API takes a line of text and answers what it becomes. In the designer, a breakpoint stops a run so that the values of an item can be looked at.