Using Wildcards to
Specify Groups of Files
Tumpal Tambunan
Suppose a disk in Drive A contains variuos MS-DOS command (.COM) files. You could use the following dir command to view a list of all files that have a .COM extension:
dir a:*.comAnother way to view filenames on a disk is to use the dir command with the /w switch. The /w switch lists only the filenames and directory names and displays them across the width of the screen in several columns. You could view a list of files on a disk in drive A by using the following command:
dir a: /wWhen you use the preceding command, MS-DOS displays a list similiar to the following:You can use wildcards to view selected groups of filenames in this listing. For example, to view only filenames that have the .COM extension, type the following command:Volume in drive A is TambunanVolume serial Number is xxxx - xxxxDirectory of A:\AUTOEXEC.BAT BACKUP.EXE COMMAND.COM CONFIG.SYS COUNTRY.SYSDISKCOPY.COM DISPLAY.SYS EGA.CPI FDISK.EXE FORMAT.COMKEYB.COM KEYBOARD.SYS LCD.CPI MODE.COM REPLACE.EXERESTORE.EXE SYS.COM17 File(s) 566862 bytes77824 bytes freedir a:*.com /wMS-DOS lists the program files that have the .COM extension:In addition to substituting for an entire name or extension, the asterisk wildcard can substitute for parts of a name or extension. For example, to view filenames that begin with the letter C on a disk in drive A, type the following command:Volume in drive A is TambunanVolume serial Number is xxxx - xxxx
Directory of A:\
COMMAND.COM DISKCOPY.COM FORMAT.COM KEYB.COMMODE.COM SYS.COM6 File(s) 197439 bytes77824 bytes freedir a:c*.* /wMS-DOS lists the files that have names beginning with the letter C:If you use the asterisk wildcard to copy or delete a file, be careful not to specify a group of files instead of a single file. For example, if you have a file called MYTES.TXT and another named MYSALE.TXT, both files will be copied to drive A if you type the following command:Volume in drive A is TambunanVolume serial Number is xxxx - xxxxDirectory of A:\COMMAND.COM CONFIG.SYS COUNTRY.SYS3 File(s) 50459 bytes77824 bytes freecopy my*.txt a:Unlike the asterisk wildcard, which substitutes for any or all characters in a name or extension, the question mark (?) wildcard substitutes for a single character. For example, to list the files that have names of up to three letters, type the following command:dir a:???.* /wMS-DOS lists files that have names of up to three letters, regardless of the name or extension:Volume in drive A is Tambunan
Volume serial Number is xxxx - xxxx
Directory of A:\SYS.COM EGA.CPI LCD.CPI3 File(s) 71227 bytes77824 bytes free
|
You may also like: