Navigation:  Commands and Procedures >

File Inclusion/Exclusion Matching

Previous pageReturn to chapter overviewNext page

Many Visual Build file actions support fields for including and/or excluding the files to process.  Visual Build actions support the following method for matching of filenames.

 

If the Include and Exclude fields are empty, all files in the specified folder (and subfolders if processing recursively) will match.  Otherwise, the Include and Exclude fields can contain one or more file or folder names or wildcards/masks, each on a separate line.  Only files matching all include values and not matching any exclude values will be processed.  Matching is non-case-sensitive.

 

Three types of matching are supported:

 

#1 Broad Filename Matching

 

To match a specific filename or filename wildcard in any matching folder, enter the filename or mask on a separate line.

 

Supported wildcard characters are * (matches zero or more characters), ? (matches any single character), and . (matches the separator between the filename and extension).

 

For example:

ReadMe.txt

Matches all files or folder containing files (at any level if recursive) named ReadMe.txt

*.txt

Matches all files or folder containing files (at any level if recursive) with a txt extension

Test*.

Matches all files or folder containing files (at any level if recursive) starting with Test and having no extension

VisBuildPro.*

Matches all files or folders containing files (at any level if recursive) beginning with VisBuildPro and ending with any extension

W?x.t?t

Matches any filename or folder containing files (at any level if recursive) starting with W, followed by any character, followed by x, and with extension of t, any character, followed by x

 

#2 Broad Folder Matching

 

To match a specific folder or folder wildcard at any level, enter the folder name or mask on a separate line, prefixed with a slash / or backslash \ character.  For example:

/Test

Matches a folder (at any level if recursive) named Test

/Vis*

Matches a folder (at any level if recursive) starting with Vis

/*Build

Matches a folder (at any level if recursive) ending with Build

 

Notes:

Inclusion/Exclusion of folders takes precedence over files -- if a folder is excluded, none of the files in a matching folder will be included, and if a folder is included, only files within matching folders will be matched.  Any folder name within nested folders will be matched for include or exclude (for instance, all files in the subfolder abc/xyz would be excluded if /abc or /xyz was found in the exclusions).

 

#3 Advanced File Matching

 

For advanced file matching, the include/exclude fields support extended file globbing pattern matching.  This is specified by entering one or more folder names or wildcards separated by a slash / or backslash \ character and ending with a filename or wildcard.

 

The folder names are matched starting with the immediate folder under the root folder specified for the action.  An additional wildcard of ** can be specified to recursively match any folder name.

 

Some examples:

**/VisBuildPro/*.bld

Matches all .bld files within a folder named VisBuildPro, recursively at any level

Production/Files/ReadMe.txt

Matches the ReadMe.txt file only in the subfolder Production/Files

**/B*/**/Read*.*

Matches any file starting with Read in any subfolder under a folder starting with B at any level

B*/*.rc

Matches all files with .rc extension in any folder starting with a B only at the root level