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.

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.

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)

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.

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 NAMEDESCRIPTION
%p1Right-most folder component of matching source path
%p2Second right-most folder component of matching source path
%p3Third 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.

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 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.

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.

Get Instant Access to Files.com

The button below will take you to our Free Trial signup page. Click on the white "Start My Free Trial" button, then fill out the short form on the next page. Your account will be activated instantly. You can dive in and start yourself or let us help. The choice is yours.

Start My Free Trial

©2024 Files.com. All right reserved

FILES.COM

  • Start My Free Trial
  • Pricing
  • Docs
  • API and SDKs
  • Contact

CONTACT & SUPPORT

support@files.com

(800) 286-8372

Monday–Friday

9am–8pm Eastern