Folder Comparison Filters

When performing folder comparisons, there may be situations where you want to include or exclude items from the results list based on their type, name, or location within the folder hierarchy. Merge enables you to configure filters to control the inclusion and exclusion of items in the comparison results list.

Defining filters

Filters can be configured using the controls in the Filters options page.

You can define as many filters as you like, but only one can be active at a time. A filter contains any number of patterns that define which files and folders to include or exclude, based on their name and/or type.

When determining whether a file or folder should be included in the results list, Merge will work through the patterns in the active filter from the top to the bottom. The bottom-most pattern that matches the file or folder will determine whether the file or folder is included or excluded from the results list. A file or folder will not be included in the results list if it is not matched by any patterns.

The default filter contains a pattern (or patterns) that cause all files and folders to be included. It is generally easier to start out by including everything, and then to add patterns that strip files and folders out of the results. In particular, we recommend always starting off with a pattern that at least includes all folders. If a folder is not included in the results list then the files and folders within it will not be included either – even if they are matched by subsequent include patterns.

Each pattern contains three configurable settings. The first (Type) controls whether the pattern is responsible for including or excluding items in the results list. The second (Match) controls the type of item that the pattern can match - files, folders, or either. The third (Pattern) consists of text that will be matched against the names of the files and/or folders, and is discussed in more detail below.

For a pattern to match a file or folder, the pattern’s Match and Pattern settings must match the type and name of the file/folder respectively. When a pattern matches a file or folder, the pattern’s type (Include or Exclude) is applied to the file or folder. The last matching pattern has the final say on whether a file or folder is included or excluded.

A pattern’s text is compared against the names of files and folders to see whether a pattern is applicable to them. The text can have a simple value like filename.txt, which would match files or folders of that name, or a more complex value including wild-card characters and path-separators. Wild-card characters include * to match any sequence of characters except for path-separators, ** to match any sequence of characters including path-separators, and ? to match any single character. Multiple pattern texts can be included within a pattern by separating them with a semicolon or comma character.

Pattern text is normally matched against the name of a file or folder, but if you want to match against the location of the file or folder as well as the name then you can include path-separators in the pattern text too.

Examples

Example 1: Include all files and folders

Type Match Pattern Description
Include Folders ** Include all folders
Include Files ** Incude all files

Example 2: Include all files and folders

Type Match Pattern Description
Include Files & Folders ** Include all files and folders

Example 3: Include all folders, and any file with the name ‘Makefile’

Type Match Pattern Description
Include Folders ** Include all folders
Include Files Makefile Include files called Makefile

Example 4: Include all folders, and any file that has a ‘.cpp’ suffix

Type Match Pattern Description
Include Folders ** Include all folders
Include Files *.cpp Include files with a .cpp suffix

Example 5: Include all files beginning with ‘a’ unless they end with ‘,v’

Type Match Pattern Description
Include Folders ** Include all folders
Include Files a* Include files beginning with a
Exclude Files *,v Exclude files ending with ,v

Example 6: Include all files and folders, excluding any files with a ‘.obj’ or ‘.exe’ suffix or a ‘tmp’ prefix

Type Match Pattern Description
Include Files & Folders ** Include all files and folders
Exclude Files *.obj;*.exe;tmp* Exclude files with a .obj or .exe suffix or tmp prefix

Example 7: Include all folders, and files with a ‘.xml’ suffix at any depth under a folder with the name ‘help’

Type Match Pattern Description
Include Folders ** Include all folders
Include Files help/**.xml Include files with a .xml suffix at any depth under a folder called help

Information Forward-slash characters can also be used as a path separators. Merge assumes they have the same meaning as backslash path separator characters.

Example 8: Include all files and folders, excluding all files with a ‘,v’ suffix that appear at the top level of a CVS or RCS subdirectory

Type Match Pattern Description
Include Files & Folders ** Include all files and folders
Exclude Files "CVS/*,v";"RCS/*,v" Exclude files with a ,v suffix under CVS and RCS subfolders

Information Use quotation marks if you want to include a semicolon or comma character in a pattern.

Example 9: Include all files and folders, excluding all files with a ‘,v’ suffix that appear at any depth under a CVS or RCS subdirectory.

Type Match Pattern Description
Include Files & Folders ** Include all files and folders
Exclude Files "CVS/**,v";"RCS/**,v" Exclude files with a ,v suffix anywhere under CVS and RCS subfolders

Example 10: Include all files and folders, excluding a top-level subfolder called ‘build’, and any files under a top-level subfolder called ‘packaged’ that have a prefix of ‘merge\’ followed by four characters and a suffix of ‘.dmg’

Type Match Pattern Description
Include Files & Folders ** Include all files and folders
Exclude Folders /build Exclude a top-level folder called build
Exclude Files /packaged/merge_????.dmg Exclude files contained within a top-level subfolder called packaged that have a prefix of merge_ followed by four characters and a suffix of .dmg