Folder Comparison Filters
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

Folder Comparison Filters

The folder comparison filter is an ordered list of name filters used to match the names of files or folders you are comparing. You can use Compare to evaluate the file or folder names against the name filters. Once Compare finds a match or exclusion, the comparison stops.

The default name filters are:


The following wildcard characters having special meaning when used in a name filter:

  • ? - Matches exactly one character

  • * - Matches zero or more characters

  • ! - Specifies an exclusion name filter

  • \ - Specifies a folder name filter

  • ; - Name filter delimiter


    The following characters are not allowed in name filters: " < > | \b \0 \t and characters 0-31.

The name filters are applied to the file and folder names using the following rules:

  • When Compare evaluates a file or folder name, it compares the name to each filter in the order you specified the filters. As soon as the file or folder name matches a filter, the name is a match and it is not compared against the remaining filters.

  • A folder filter must end with the \ wildcard character.

  • An exclusion filter must begin with the ! wildcard character.

  • If you specify any filters that are not the exclusion filter, only files or folders that match the specified filters are included in the results.

  • If you specify an exclusion filter, all files or folders that do not match the exclusion filter are included in the results.

  • If you want to exclude a subset of file or folders names, you must specify the filter for the file or folder name you want to match first and then specify the exclusion filter.

Filter name mask examples:

Name Mask



Matches all C# files.


Matches all bitmap files that begin with My.


Excludes all executable files.


Excludes all objd folders.

Filter examples:




Matches all C# files except those in objd, obj, or bin folders.


Excludes all .resx and .ini files, all files in the resources folder, and all files in any folder with a name that includes the word junk.

© 2015 Microsoft