File Masks & Wildcards

Overview

Automate supports the use of file masks and wildcard characters in any action or trigger parameters that indicate folder or file names, commonly, the File system, Compression, Cryptography and FTP actions. A file mask is essentially a pattern of fixed and wildcard characters used to match folder and file names. They provide a flexible means for identification of a specific file or group of files based on their name and extension. A wildcard character can be used to substitute for any other character or characters in a string. By using masks and wildcards, you can easily specify which files and/or folders should be processed and which should be ignored.

Parameters

File masks can consist of any combination of the following:

  • Fixed characters - Letters, numbers and other characters allowed in file names.

  • Question mark (?) - Represents any single character.

  • Asterisk (*) - Represents any sequence of characters (including no characters at all).

While it is well-defined that a file mask containing only fixed characters uniquely identifies a file (that is, the file mask myFile.txt refers to, and only to, a text file named myFile.txt), a file mask containing wildcard characters ? and/or * can refer to single or multiple files.

Multiple File Masks

In most contexts, you can specify multiple files or combine several wildcard masks by separating each with a pipe (|) character. For example, the following mask includes all JPG and GIF images contained in c:\temp\:

c:\temp\*.jpg|*.gif. 

Examples

Wildcards allow a file mask to match multiple folder or file names. The table below provides a variety of file mask examples:

File Mask Description & Examples
* Matches all files containing any amount of characters, with or without extensions (for example, entering A* would match any file or folder starting with the letter A followed by any amount of characters).
*.* Matches all files containing any amount of characters and with any extension. Even matches files that don't have an extension (for example, entering A*.* would match any file starting with the letter A followed by any amount of characters along with any extension).
? Matches any single character (for example, entering A? would match any file starting with the letter A followed by any single character).
*.png Matches all files with names containing any amount of characters with a .png extension (for example, image_name.png, cool_pic.png, 1.png).
*.p* Matches all files with names containing any amount of characters with an extension starting with the letter p (for example, document.pdf, image_name.png, business.project, 1.ppt).
pic*.* Matches all files with names that start with pic (for example, picture_name.png, pictogram.ico).
*mat?.html Matches all .html files with names starting with any sequence of characters, followed by the string mat, and ending with a single character (for example, automate.html, mate.html, tomato.html).
?????? Matches all files with names containing six characters and without an extension (for example,123456, myFile, my_pic, images)  
doc?????.pdf Matches all .pdf files with names that start with doc followed by any five characters (for example, document.pdf, doctrine.pdf, doc_1234.pdf).
file1.txt|file2.jpg|file3.png Matches specific file names or wildcard masks that reside in the same directory (for example, c:\temp\file1.txt|file2.jpg|file3.png).
NOTE: Files with invalid paths are ignored at runtime.
c:\temp1\*.txt|c:\temp2\*.png Matches specific file names or wildcard masks that reside in different directories (for example, c:\photos\*.jpg, \c:\music\*.mp3).
NOTE: Files with invalid paths are ignored at runtime.