Skip to main content

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.

Exclude Pattern Matching

For Copy, Move, and Delete file automations, you can specify an exclude pattern to ignore certain files or folders based on their path names. If set, path names matching this pattern will be ignored/excluded. This setting takes precedence over the Pattern for file names to contain setting when a path matches both settings. For example, if your Automation is configured to move files that match the pattern *.pdf, you could set an exclude pattern of **/*2024*.pdf to recursively exclude any PDF files containing "2024" in their filename.

To exclude files and folders based on specific words or phrases, use wildcards in the exclude pattern. For instance, the pattern **/*temp* will exclude any file with "temp" in its name within the selected source path, such as tempfile.docx or project_temp_final.pdf. To exclude any folder name containing "temp" in the current selected source path, use **/*temp*/*.

Character-based exclusions provide even more filtering options. For instance, using **/report_20??.* will exclude files that start with "report_20" followed by any two characters, such as report_2025.pdf. Numeric patterns are also supported; for example, **/[0-9]*.txt will exclude files starting with a number and ending with .txt, like 123notes.txt or 2025report.txt.

Day-based exclusions allow for patterns like **/*_{Mon,Tue,Wed}*.*, which excludes files with any of these weekday abbreviations, such as report_Mon.xlsx or meeting_Wed.docx. Similarly, **/*[01..31]*.docx excludes files containing any day (01 to 31) in the filename, like file_12_report.docx, which is useful for skipping daily logs.

For complex exclusions, alternatives in curly brackets {} can be used. For example, **/{temp,backup,old}*.* excludes files starting with "temp," "backup," or "old" with any extension, such as backup_final.xlsx or old_report.docx.

Special characters can also be excluded with precise matching. For instance, **/*$*.* excludes any file with a $ symbol, like price_report$.pdf. Additionally, to exclude files with specific characters in precise locations, you can use patterns like **/*test[\*]file* to exclude files such as testfile.docx that contain an asterisk between terms, while still allowing similar files like testfile_final.docx or testfile_backup.docx that do not match the exact test*file pattern.

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.