Using the * Wildcard

If you wish to operate on the files whose primary names begin with A, you could specify the wildcard pattern as A???????.???.

This would match all file names beginning with A. However, using ? here proves to be very cumbersome. Instead of using ?, you could use the wildcard character *. The wildcard * can replace eight or less characters in the primary name and three or less characters in the extension. This is quite unlike ? which replaces only one character. The wildcard pattern which could be used here is A*.*.

From our first example, the file names that would match this pattern would be:


Let us take another example to understand this better. If you want to work on all files that have the extension .EXE, the wildcard pattern that could be specified is *.EXE. All file names with a primary name of any length and with an extension .EXE would match this pattern.

Thus, the ? wildcard provides character by character substitution, while the * wildcard is suitable when the number of characters to be matched varies.

DOS ignores any character which follows the * wildcard in the primary name upto the dot that separates the primary name from the extension.

For example, if you use the wildcard pattern *C.TEM, it would match all files with the extension TEM and not just those whose primary names end with C. The character C is ignored by DOS since it follows the * wildcard.

Similarly, if any character follows the * wildcard in the file name extension, it is ignored by DOS. For example, PAYROLLS.