Include/Exclude Files & Directories
The Include/Exclude Files and Directories dialog is activated from the button next to the File Mask fields in the main window and the script dialog. This editor is used to construct complex expressions to insert in the file mask fields. These expressions allow you to further specify which subdirectories and files under the search path to include (or exclude) from your search &/or replace. For example, it is possible to exclude files of one type in some subdirectories while including files of the same type if they reside in other subdirectories. You may use the * and ? wildcards as in the DOS dir command to refer to subdirectories.
To enable complex Include/Exclude masks, be sure to turn on the "Search Subdirectories" field in the Main Window or the Advanced Script dialog!
Click on the graphic below for help on the main window fields or scroll the screen down for a text description of the fields and additional notes.
Details on the Include/Exclude Files and Directories dialog:
Include Exclude Mask List: The list of masks that will be inserted into the mask field when you click the OK button. Each expression here will be combined as a single expression separated by semi-colons.
Include Exclude Mask Buttons:
Up Button: Moves the highlighted mask in the Include/Exclude list up one step.
Down Button: Moves the highlighted mask in the Include/Exclude list down one step.
Apply Button: Creates a mask in the Include/Exclude list for the data listed in the fields on the right side of the dialog.
Add Button: Creates a new blank mask at the bottom of the Include/Exclude Mask list.
Insert Button: Inserts a blank mask in the Include/Exclude list above the highlighted line.
Delete Button: Deletes the highlighted mask in the Include/Exclude list.
Include Field: Mark this to have the data in the other fields to the right of the dialog be an "include" mask.
Exclude Field: Mark this to have the data in the other fields to the right of the dialog be an "exclude" mask.
Files Matching Field: Enter either a specific filename or a wild card expression to use. The wildcard operators are the same as the DOS dir command, e.g., the ? and * characters may be used. "Files Matching" may be used alone to specify a general include or exclude file mask or it may be combined with data involving the "Directories Matching" field below to identify files in some directories but not others.
Directories Matching Field: Enter a directory name or a wildcard specified directory name to use. The wildcard operators are the same as the DOS dir command, e.g., the ? and * characters may be used.
All Field: Mark this to use only the data in the "Files Matching" field. The "All" field is mutually exclusive with the "Use Match" field. To use data in your mask from both the "Files Matching" and "Directories Matching", mark the "Use Match" field.
Use Match Field: Mark this to use an expression involving a subdirectory name specified in the "Directories Matching" field. The "Use Match" field is mutually exclusive with the "All" field. To use data in your mask from both the "Files Matching" and "Directories Matching", mark the "Use Match" field.
Any Number of Levels Under Start Directory Field:
a) Leave this unmarked to include (or exclude) the directory specified in the "Directories Matching" field that exists immediately under the start path directory. For example, given the staring path c:\test\, the expression ~\skip_me\ would skip the files in c:\test\skip_me\. However, files in c:\test\more\skip_me\ or c:\test\skip_me\test2\ would be processed. To also skip files in subdirectories under c:\test\skip_me\test2\, turn on the "Also Process Subdirectories" field.
b) Mark this to include (or exclude) the directory specified in the "Directories Matching" field no matter how many levels below the start path directory it exists. For example, the expression ~\*\skip_me\ would exclude the files in c:\test\skip_me\ and c:\test\more\skip_me\. Files in subdirectories under c:\test\skip_me\ and c:\test\more\skip_me\ that are not named "skip_me" would be processed, e.g., c:\test\more\skip_me\more2. To also skip files in 'more2', turn on the that "Also Process Subdirectories" field.
Also Process Subdirectories Field: Mark this field to include (or exclude) subdirectories below the directory specified in the "Directories Matching" field. For example, given the start path c:\test\ and the expression ~\skip_me\*\, all subdirectories under c:\test\skip_me\ would be excluded. Note that if "Also Process Subdirectories" was not checked (e.g., an expression such as ~\skip_me\), files in c:\test\skip_me\ would be excluded but files in c:\test\skip_me\test2\ would be included.
OK Button: Inserts the items in the mask list into the File Mask field in the main dialog.
Cancel Button: Quits the dialog without making changes.
Help Button: This will probably activate the online help :-).
To enable complex Include/Exclude masks, be sure to turn on the "Search Subdirectories" field in the Main Window or the Advanced Script dialog!
The program builds the complex file masks from left -> right. In general, specify masks to include first, followed by excludes. For example, ~\images\i*.txt;*.* is not recommended. Use *.*;~\images\i*.txt instead.
The rules for complex masks are perhaps best understood by example. Use the below chart as a guide and experiment with the dialog on temporary data before using complex masks on critical data.
By way of a general explanation in words:
- When a string involving the * meta character is followed by a \ character a subdirectory is referenced. For example, \*mage*\, \*mages\, \image*\ refer to subdirs.
\*\ preceding a subdir specification refers to 'any number of levels below the parent search path. For example, ~\*\test\ excludes any paths named test any number of levels below the starting search path.
\*\ following a subdir specification can be thought of as 'and also any subdir level below that point. For example, ~\test\*\ excludes \test immediately under the starting search path and all paths under \test. A path named \whatever\test would be searched.
\*\ surrounding a path means 'any number of levels below the parent search path and also everything under that. For example, ~\*\test\*\ would exclude any path named test at any point under the parent search path. Following from the above, ~\*\test\*\ would not search \whatever\test.
File mask specifications can be supplied after the closing \ for a subdir reference. If you don't use * in the path reference you must specify * after the \ character. For example, *.*;~\images\* should be used and not *.*;~\images\ alone. In contrast, the program assumes a file spec of *.* if the * character is used in a path reference. For example, ~\image*\ is interpreted as ~\image*\*, which is the same as ~\image*\*.*.
Complex file masks can be used in combination with subdir references. For example, *.*;~\test\*.txt excludes *.txt files in \test\ but search all other files under \test
The examples below are oriented toward excluding subdirs/files but you can use complex notation as an include. See below.
When referencing files, * alone can be used. As most Windows files have a single . character in them this is the same as *.*
It is OK to divide complex exclude masks into separate components separated by the ; character. For example, a mask to exclude all files named test* in all subdirs and also subdir names that begin with \test are best divided into separate components. See below.
Expression |
Effect |
*.*;~\images\* |
Skip files in the images subdir right below the starting path for the search. You could also use *.*;~\images\*.* |
*.*;~\images\*\ |
As above but also skips subdirs under images |
*.*;~\*\images\*\ |
Skip files in any subdir named images |
*.*;~\*\images\*.jpg |
Skip .JPG files in an images subdir any # of levels below the start path |
*.*;~\* |
Skip files in the 'root' of the Path field. |
*.*;~\images\test\ |
Skip files in images\test. *.*;~\images\test\*.* does the same thing. |
*.*;~\images\te*\ |
Skip files in images\test, images\testing, etc. |
*.*;~test*.*;~\images\te*\ |
Skip files named test.txt, testing.txt, etc and also |
\*\images\*\i*.txt |
A include mask only. This searches only i*.txt files in any subdir named \images any level below the search start path. |
*.htm;~\*\_vti*\*\ |
Uses wildcards to skip all the specialized Front Page subdirs in a Front Page web. |