Matching Source Path and Filenames


There are various methods to match the source content for the automation to act on. You can define patterns and criteria that the folders or files must meet for the automation to be triggered. These patterns can include folder structure, specific file names, extensions, or even wildcards to capture a range of files.

By setting these parameters, you ensure that the automation only processes files that match the defined criteria, allowing for precise control over which files are included in the workflow. For instance, you might specify that only .csv files in a particular directory should be acted upon, or use wildcards to include all files in a subfolder. This flexibility allows you to tailor the automation to suit various needs and scenarios.

Path Matching

The path attribute in automation specifies the folders to which the automation applies, working in conjunction with the source attribute to determine the affected files. This attribute supports globs and exclusively refers to folders, not files. The combination of the path and source attributes identifies which files the automation will target. It's important to note that automations only operate on files, even though paths can point to folders that may not yet exist.

Path Globs

Path globs in automations allow for flexible folder matching using wildcards. The * matches any folder at that specific level in the path but excludes subfolders, while the double asterisk ** matches subfolders recursively. For instance, path/to/* matches path/to/folder1 and path/to/folder2, but not path/to/folder1/subfolder, whereas path/to/** includes all subfolders.

The question mark ? matches any single character, and square brackets [] can be used to match any character from a set, similar to regular expressions. However, globs are not supported on remote paths.

By default, Copy and Move automations that use globs will implicitly replicate matched folder structures at the destination. You can optionally flatten the folder structure at the destination.

File Name Pattern Matching

For Copy, Move, and Delete file automations, you can optionally specify a pattern for file names to match using standard text with or without wildcards, or file extension matching (like *.pdf). For example, the pattern matching text *paid* matches any file with a name containing the word 'paid' (case-insensitive). You can also build an expression to match any single character using ?, or match an array of characters using []. To match any of the special characters literally, precede it with a backslash and enclose that pair with square brackets. For example to match a literal ?, use [\?].

You can negate any digits or characters in the file name using ^. For instance, [a-z].*will match all file names that contain only letters, while [^a-z].* means it won't match if the file name contains any characters between 'a' and 'z'.

You can also use time-related patterns with the source file name pattern matching. For example, a move file automation with the source file name pattern %Y%m%d*.* can match all file names starting with today's date in YYYYMMDD format and move those files from source to the destination.

Curly brackets {} can be used to denote parts of a pattern which will accept a number of alternatives, separated by commas ,. These alternatives can either be literal text or include special characters including nested curly brackets. For example *{Mon,Tue,Wed,Thu,Fri}* would match any files whose name contains abbreviated weekdays, and 202{3-{0[7-9],1?},4-0[1-6]}-* would match files starting with dates from 2023-07-01 through 2024-06-30.

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