Skip to main content

Customizing Destination Path and Filenames

When setting up Destination filenames in Automations, you can include pattern characters that get substituted with values related to the Automation's run. The patterns below cover destination paths, trigger context, source paths, and time values.

For Copy or Move file Automations, the destination path determines where files are copied, moved, or created. The path can include formatting parameters that 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. When the destination path does not end with a /, the destination field serves as a replacement for the filename.

These apply only if the Automation trigger is a File Action, and refer to the filename of the triggering File Action:

Token NameDescription
%tpEntire path of triggering File
%tfFilename of triggering File (without folder name)
%tdFolder name of triggering File (without file name)
%tbFilename of triggering File (without folder name and file extension)
%teExtension of triggering File

For example, when the triggering file is at path/to/file.txt, the Automation destination path/to/dest/incoming-%tf resolves to path/to/dest/incoming-file.txt.

When the Automation trigger is an Inbound Webhook, any GET or POST parameters sent to that Webhook can be used by name. Parameters are limited to 190 characters each and 550 characters in total.

The pattern %u-[GET or POST Param name] is replaced by the value sent in that GET or POST parameter to the Inbound Webhook. For example, when the Inbound Webhook receives a parameter named username, the replacement pattern %u-username resolves to that value.

These tokens apply based on the source path of the Automation. Source paths can include wildcard characters, and these tokens convert those wildcards in the source into meaningful values in the destination.

Two token families are available. %p tokens count folders from the matched file upward. %P tokens count folders from the root downward. Both work in destination folder paths and destination filenames, and you can mix them in the same destination.

Token NameDescription
%p1, %p2, %p3, ...Folder name in the source path, counted upward from the matched file. %p1 is the matched file's parent folder.
%P1, %P2, %P3, ...Folder name in the source path, counted downward from the root. %P1 is the top-level folder.

For example, when the source file is partner/app/team/inbound/file.txt, the destination archive/%P1/%P3/%P4/ resolves to archive/partner/team/inbound/.

Here is how that works. Each folder in the source path can be referenced from either direction:

FolderTop-down (%P)Bottom-up (%p)
partner%P1%p4
app%P2%p3
team%P3%p2
inbound%P4%p1

Build a destination by replacing folder names with the tokens you want. Using the same source file, the bottom-up destination archive/%p4/%p2/%p1/ resolves to the same folder, archive/partner/team/inbound/.

You can also mix token families in the same destination. For example, archive/%P1/%p1/ resolves to archive/partner/inbound/, anchoring the top-level folder while pulling the file's parent folder.

When To Use Each

Use %P when the folder you care about sits near the root and never moves, like a partner name, a department name, or a region.

Use %p when the folder you care about sits right above the file, like a date folder or a batch folder.

Mix both when you need to anchor to the root on one end and the deepest match on the other. For example, archive/%P1/%p1/ pulls the top-level folder and the file's parent folder into the same destination.

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 NameDescription
%aAbbreviated weekday name (eg Mon)
%AFull weekday name (eg. Monday)
%bAbbreviated month name (eg. Jan)
%BFull month name (eg. January)
%CCentury number (the year divided by 100, range 00 to 99)
%dDay of the month (01 to 31)
%eDay of the month (1 to 31)
%HHour, using a 24-hour clock (00 to 23)
%IHour, using a 12-hour clock (01 to 12)
%jDay of the year (001 to 366)
%mMonth (01 to 12)
%MMinute (00 to 59)
%pEither am or pm according to the given time value
%rTime in am and pm notation
%RTime in 24 hour notation
%SSecond (00 to 59)
%TCurrent time, equal to %H:%M:%S
%uWeekday as a number (1 to 7), Monday is represented as 1.
%UWeek number of the current year, starting with the first Sunday as the first day of the first week
%VThe 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
%WWeek number of the current year, starting with the first Monday as the first day of the first week
%wWeekday as a number (0 to 6), Sunday is represented as 0.
%yTwo-digit year without a century (range 00 to 99)
%YFour-digit year including the century
%ZTime zone or name or abbreviation
%%A literal % character

Find and Replace Text in File Names

For Copy or Move file Automations, you can search for specific text in the destination file name and replace it with your preferred text. For example, configure the Automation to find all destination file names containing the text Reviewed and replace it with the text Final. Any destination file name containing Reviewed (such as Invoice-Reviewed.pdf) is renamed to Invoice-Final.pdf. The search is case-sensitive, and wildcards are not supported.

The Text to find in file name and Replace with settings only replace one static text with another. You cannot substitute any time-related wildcard symbols using either field.

Overwriting Existing Files

For Copy or Move file Automations, you can specify to overwrite files if they already exist at the destination.

For the Copy file Automation type, enabling the above option provides a second option that lets you overwrite even when the file size is identical. This second option replaces existing files with newer copies, even when the file size of the newer copy is identical. We recommend only using this second option when needed, to avoid accidentally consuming unnecessary data transfer.

When overwriting a file on the destination path, the existing file is deleted first, then the new file is copied or moved to the destination. Both delete and create actions are logged.

Flatten Folders

For Copy or Move file Automations, you can specify whether to flatten the folder structure at the destination. When this option is enabled, the source folder structure is flattened at the destination, and all files from the source folder hierarchy are 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.