subscribe: Posts | Comments

DIR Options

Comments Off

Two little characters, ‘*’ and ‘?’, will make your life with computers much easier. Their use is illustrated below.

Example:

•C> dir a:*.ex
•Lists all files on the A drive with an extension of ‘EXE’.
•C> dir b:kermit.*
•Lists all files on the B drive with a filename of ‘KERMIT’.
The asterisk is a wild-card character which allows the user to enter only a limited part of a file specification to find a file. It is useful when you wish to locate a group of files with the same filename or the same extension. On other occasions you may have forgotten part of a file specification. You can use ‘*’ in place of the parts of the specification you have forgotten. Similarly, ‘?’ permits wild-card searches keyed to single characters.

Example:

•C> dir a:labe?.com
•Lists all five-letter files with the first four letters ‘LABE’ and an extension of ‘COM’.
•C> dir b:format.c??
•Lists all files with a filename of ‘FORMAT’ and an extension beginning with ‘C’.

Wild-card characters can be used in combination.

Example:

•C> dir a:labe?.*
•Lists all five-letter files with the first four letters ‘LABE’ and any extension.
•C> dir c:*.ex?
•Lists all files with an extension beginning with ‘EX’.
Experiment with ‘*’ and ‘?’ to improve your ability to find files quickly. These wild-card characters can also be used with several other DOS commands.