An input file specification consists of a list of one or more filenames, and zero or more file selection options.
> d *.tmp *.xyz -before=yesterday
The entire string *.tmp *.xyz -before=yesterday is a file specification.
The d (directory), dele (delete), and pu
(purge) commands all accept a list of files like that.
You can give a list of files to cop
(copy) or rena
(rename) too, but then the list of files has to be enclosed in
parentheses.
> rena (*.tmp *.xyz) old\ -before=yesterday
> rena \('*.tmp' '*.xyz'\) old/ -before=yesterday
If we had left out the parentheses in this example, we would have gotten an error message saying that there were too many parameters. rena expects exactly two parameters, one input file specification and one output file specification, but when the input list of files is enclosed in parentheses, it only counts as a single parameter.
The parentheses must be preceded by a backslash escape character under Linux.
If we had wanted, we could have placed the -before option
inside the parentheses without changing the meaning of the command.
File specifications can be made arbitrarily complex using -exclude
options and nested file specifications within parentheses.
Under Windows, the command
> d alice.txt .doc ***\bob .html
will look for alice.txt and alice.doc in the current
directory, and bob.doc and bob.html in the current
directory and all its subdirectories.
If the sticky defaults were written out, the command would be
> d alice.txt alice.doc ***\bob.doc ***\bob.html
The directory path is seen as a single item when it comes to
"stickiness". On Windows this includes the device name, if the filename
contained one.
For example, if the current device is disk C:, the
command
> d e:\glindra\data\alice.* bob \temp\
has the same meaning as
> d e:\glindra\data\alice.* e:\glindra\data\bob.* C:\temp\bob.*
When a file specification is given as the value of an option, such
as -exclude, it must
be surrounded by parentheses if it
consists of anything more than a single filename.
> d -exclude=(*.tmp *.xyz -before=yesterday)
> d -exclude=\('*.tmp' '*.xyz' -before=yesterday\)
The command will list all files in the current directory, except
files with the extension .tmp or .xyz that were created
before yesterday.
Note that the -before option only applies to the exclusion,
and not to the file selection as a whole. This is because it appears
inside the parentheses. The command will list files that were created
before yesterday, as long as the have another extension that .tmp
or .xyz, and it will list those .tmp and .xyz
files that were created yesterday or today.