Customizing Destination Path and Filenames
When setting up Destination filenames in Automations, you may include pattern characters that will be substituted with values related to the Automation's run.
This is a reference of the available patterns to use for substitution.
Destination Path Related
If you are creating an automation to Copy or Move files, the destination path determines where files will be copied, moved, or created. It has the capability to include formatting parameters like below, which can dynamically determine the destination at runtime.
Relative vs. Absolute Path
When a destination path starts with ./
or ../
, it is treated as a relative path. In all other cases, it is interpreted as an absolute path.
Files vs. Folders
When a destination path ends with a /
, it is recognized as a folder name, and the original filename is retained. On the other hand, if the destination path does not end with a /
, the destination field serves as a replacement for the filename.
Trigger Related
These apply only if the Automation trigger is a File Action, and refer to the filename of the triggering File Action:
Token Name | Description |
---|---|
%tp | Entire path of triggering File |
%tf | Filename of triggering File (without folder name) |
%td | Folder name of triggering File (without file name) |
%tb | Filename of triggering File (without folder name and file extension) |
%te | Extension of triggering File |
If the Automation trigger is an Inbound Webhook, any GET or POST parameters that are sent to that Webhook can be used by name. Parameters are limited to 190 characters in length each and 550 characters in length total.
For example, if the triggering file is at path/to/file.txt
, then the automation destination path/to/dest/incoming-%tf
will result in the actual destination being path/to/dest/incoming-file.txt
.
%u-[GET or POST Param name]
- will be replaced by the value sent in that GET or POST parameter to the Inbound webhook. For example, if the inbound webhook received parameter username, replacement pattern %u-username
could be used.
Source Path Related
These apply based on the source path of the Automation. Remember that source paths can include wildcard characters, so this is how you would convert those wildcards in the source into something meaningful in the destination.
Token Name | Description |
---|---|
%p1 | Right-most folder component of matching source path |
%p2 | Second right-most folder component of matching source path |
%p3 | Third right-most folder component of matching source path |
For example, if the source file is at accounts/file.txt
, then the automation destination path/to/dest/%p1/some_file_name.txt
will result in the actual destination being path/to/dest/accounts/some_file_name.txt
.
Time Related
These are always available and use the time associated with the run time of the automation. You can optionally choose the time zone used for calculating the date/time tokens in destination file or folder names. These values are similar to the values used by the strftime
function in most standard code libraries.
Token Name | Description |
---|---|
%a | Abbreviated weekday name (eg Mon ) |
%A | Full weekday name (eg. Monday ) |
%b | Abbreviated month name (eg. Jan ) |
%B | Full month name (eg. January ) |
%C | Century number (the year divided by 100, range 00 to 99 ) |
%d | Day of the month (01 to 31 ) |
%e | Day of the month (1 to 31 ) |
%H | Hour, using a 24-hour clock (00 to 23 ) |
%I | Hour, using a 12-hour clock (01 to 12 ) |
%j | Day of the year (001 to 366 ) |
%m | Month (01 to 12 ) |
%M | Minute (00 to 59 ) |
%p | Either am or pm according to the given time value |
%r | Time in am and pm notation |
%R | Time in 24 hour notation |
%S | Second (00 to 59 ) |
%T | Current time, equal to %H:%M:%S |
%u | Weekday as a number (1 to 7 ), Monday is represented as 1 . |
%U | Week number of the current year, starting with the first Sunday as the first day of the first week |
%V | The ISO 8601 week number of the current year (01 to 53 ), where week 1 is the first week that has at least 4 days in the current year, and with Monday as the first day of the week |
%W | Week number of the current year, starting with the first Monday as the first day of the first week |
%w | Weekday as a number (0 to 6 ), Sunday is represented as 0. |
%y | Two-digit year without a century (range 00 to 99 ) |
%Y | Four-digit year including the century |
%Z | Time zone or name or abbreviation |
%% | A literal % character |
Find and Replace Text in File Names
For automation types like Copy or Move files, you can search for specific text in the destination file name and replace it with your preferred text. For instance, you can configure the Move or Copy files automation to find all destination file names containing the text Reviewed and replace it with the text Final; then, any destination file name containing the text Reviewed (e.g., Invoice-Reviewed.pdf) will be renamed to Invoice-Final.pdf. Keep in mind that the search is case-sensitive, and wildcards are not supported.
The Text to find in file name and Replace with settings can only replace one static text with another (in our earlier example, "Reviewed" is replaced with "Final"). You cannot substitute any time-related wildcard symbols using either field.
Overwriting Existing Files
For copy or move file automations, you can specify when files are overwritten if they already exist at the destination.
There are two options to choose from: overwrite files at the destination if their names match but the file sizes are different (which is selected by default), or choose to overwrite even if both file names and sizes match. The second option is available only for a copy file automation, and we recommend leaving it off to avoid accidentally consuming unnecessary data transfer.
When overwriting a file on the destination path, we start by deleting the existing file and then proceed to copy or move the new file to the destination. This will result in both delete and create actions being logged.
Flatten Folders
For copy or move file automations, you can specify whether the folder structure at the destination should be flattened or not. When this option is enabled, the source folder structure will be flattened at the destination, and all files from the source folder hierarchy will be copied into the first level of the destination folder.
This is useful when copying or moving a large folder hierarchy to a single destination folder for backup or archival purposes. You can customize destination file names or specify which files can be overwritten in the destination folder for your workflow.