EXCEPT - Exclude files from a command
Purpose: Perform a command on all available files except those
specified.
Format: EXCEPT (file ) command
file : The file or files to exclude from the command.
command : The command to execute, including all appropriate
arguments and switches.
See also: ATTRIB and File Exclusion Ranges.
File Selection
Supports extended wildcards, ranges, multiple file names, and include
lists. Ranges must appear immediately after the EXCEPT keyword.
Usage
EXCEPT provides a means of executing a command on a group of files and/or
subdirectories, and excluding a subgroup from the operation. The command
can be an internal command or alias, an external command, or a batch
file.
You may use wildcards to specify the files to exclude from the command.
The first example erases all the files in the current directory except
those beginning with MEMO, and those whose extension is .WKS. The second
example copies all the files and subdirectories on drive C to drive D
except those in C:\MSC and C:\DOS, using the COPY command:
[c:\] except (memo*.* *.wks) erase *.*
[c:\] except (c:\msc c:\dos) copy c:\*.* d:\ /s
Date, time, and size ranges can be used immediately after the word EXCEPT
to further qualify which files should be excluded from the command. If
the command is an internal command that supports ranges, an independent
range can also be used in the command itself.
When you use EXCEPT on an HPFS drive, you must quote any file names
inside the parentheses which contain whitespace or special characters.
For example, to copy all files except those in the "Program Files"
directory to drive E:\:
[c:\] except ("Program Files") copy /s *.* e:\
EXCEPT prevents operations on the specified file(s) by setting the hidden
attribute, performing the command, and then clearing the hidden
attribute. If the command is aborted in an unusual way, you may need to
use the ATTRIB command to remove the hidden attribute from the file(s).
Caution: EXCEPT will not work with programs or commands that ignore the
hidden attribute or which work explicitly with hidden files, including
DEL /Z, and the /H (process hidden files) switch available in some
CMD.EXE file processing commands.
File exclusion ranges provide a faster and more flexible method of
excluding files from internal commands, and do not manipulate file
attributes, as EXCEPT does. However, exclusion ranges can only be used
with CMD.EXE internal commands; you must use EXCEPT for external
commands.
Date, time, and size ranges can be used immediately after the word EXCEPT
to further qualify which files should be excluded from the command. If
the command is an internal command that supports ranges, an independent
range can also be used in the command itself. You can also use a file
exclusion range within the EXCEPT command; however, this will select
files to be excluded from EXCEPT, and therefore included in execution of
the command.
You can use command grouping to execute multiple commands with a single
EXCEPT. For example, the following command copies all files in the
current directory whose extensions begin with .DA, except the .DAT files,
to the D:\SAVE directory, then changes the first two characters of the
extension of the copied files to .SA :
[c:\data] except (*.dat) (copy *.da* d:\save & ren *.da* *.sa*)
If you use filename completion (see Filename Completion) to enter the
filenames inside the parentheses, type a space after the open parenthesis
before entering a partial filename or pressing Tab. Otherwise, the
command-line editor will treat the open parenthesis as the first
character of the filename to be completed.
Created using Inf-PHP v.2 (c) 2003 Yuri Prokushev
Created using Inf-HTML v.0.9b (c) 1995 Peter Childs