Most internal commands which accept wildcards also accept file exclusion ranges to further define the files that you wish to work with. TCC examines each file name and excludes files that match the names you have specified in the exclusion range.


When you use an exclusion range in a command it should immediately follow the command name. See General Rules for Using Ranges for additional details.


A file exclusion range begins with the switch character (usually a slash), followed by a left square bracket and an exclamation mark [!  The range ends with a right square bracket ]. You can specify multiple file exclusions (useful if you have a alias that is defining an exclusion and you want to pass another one as an argument).


Inside the brackets, you can list one or more filenames to be excluded from the command. The filenames can include wildcards and extended wildcards, but may not include path names or drive letters. You can exclude directories by appending a \ to the name.


The following example will display all files in the current directory except backup files (files with the extension .BAK or .BK):


dir /[!*.bak *.bk] *


You can combine file exclusion ranges with date, time, and size ranges. This example displays all files that are 10K bytes or larger in size and that were created in the last 7 days, except .C and .H files:


dir /[s10k] /[d-7] /[!*.c *.h] *


File exclusion ranges, a unique feature of TCC, work for internal commands. The EXCEPT command can also be used to exclude files from processing by any external or internal command which ignores files with the hidden attribute. You can utilize the file exclusion range with external commands utilizing the DO or FOR command; however, the performance will not be as good, since the external command is started separately for each match.


Note: File exclusion first checks to see if a file specification with embedded brackets exactly matches an existing file. If no such file is found, it interprets the brackets as wildcards.


See also: Include Lists.