File Masks
Description: A file mask is a pattern of characters and wildcards used to match folder and file names.

## Please enable JavaScript to view this site.

# Beyond Compare

- Zoom Window Out
- Larger Text | Smaller Text
- Hide Page Header
- Show Expanding Text
- Print Topic
- Save Permalink URL

File Masks | Scroll Prev Top Next More Links

A file mask is a pattern of characters and wildcards used to match folder and file names.

Example: *.* would match any filename. For historical reasons, it even matches files that don't have an extension.

Example: *.html would match any HTML filename.

Wildcards

Wildcards allow a file mask to match multiple folder or file names.

? | Matches any single character.
* | Matches zero or any other amount of characters.
[az] | Matches any single character in the set (a or z).
[a-z] | Matches any single character in the range (from a to z).
[!az] | Matches any single character not in the set (not a and not z).
[[] | Matches a single [ character.

Example: A? would match A followed by any single character.

Example: A* would match A followed by any amount of characters.

Example: [a-z0-9] would match any number or letter.

Example: [!ac-g] would match any character except for a, c, d, e, f, and g.

Simple file masks

Simple file masks will affect any files or folders whose parent folder is included. The base folder is always included. All folders which contain included files are also included.

To exclude rather than include the specified items, add a minus sign (-) in front of a file mask in the Filters edit. In the File Filters dialog, place the file mask in the Exclude edit rather than using the minus sign.

If the last character in the file mask is a period (.) then ? and * wildcards do not match periods to allow filtering of files that don't have an extension.

f | Include any file named f.
p\ | Include any folder named p.
-f | Exclude any file named f.
-p\ | Exclude any folder named p.

Example: *.pas;*.dfm;*.dpr would include only files with extensions pas, dfm, or dpr.

Example: Source\ would include only folders named Source and their subfolders.

Example: -*.dcu;-*.ddp would exclude files with extensions dcu, or ddp.

Example: -Backup\ would exclude folders named Backup.

Example: *. would include only files without an extension.

Relative file masks

Relative file masks affect files or folders in specific locations.

p\f | f must be in folder p.
.\f | f must be in the base folder.
...\f | f may have zero or more parent folders.

Example: Windows\*.txt would affect any text file in any included folder named Windows.

Example: ...\Windows\*.txt would affect any text file in any folder named Windows.

Example: .\Windows\*.txt would affect any text file in a folder named Windows that is in the base folder.