beautypg.com

Avery Dennison 6037 Rev. AA 3/04 Programmer Manual User Manual

Page 16

background image

2-6 DOS Basics

Using Wildcard Characters with Long File name Support

To simplify a task performed on a large group of similarly named files,
use wildcard characters. Wildcard characters allow you to reference
groups of files without entering the complete file name for each file in the
group. A wildcard character can substitute all or part of a file name or
extension. The two wildcard characters are the asterisk (*) and the
question mark (?). The asterisk represents an entire name or a group of
characters found within a name up to the next character in the search
mask. The question mark represents a single character. The following
table lists some examples of wildcard character usage.

Example Description

D I R C : \ T E S T \ * . E X E

Lists all files in the TEST directory having the
extension .EXE.

D I R C : \ T E S T \ A * M * . E X E

Lists all files in the TEST directory having a name that
begins with an A, contains an M, and has the extension
.EXE.

D I R D * . *

Lists all files in the current directory that start with the
letter D.

D I R D *

Lists all files in the current directory that start with the
letter D.

D I R * D

Lists all files in the current directory that end with the
letter D.

C OP Y C : \ * . B A T B : \ * . B A K

Copies all files with a .BAT extension from the C: drive

root directory onto the B: drive. The files on the B:
drive will have an extension of .BAK. This example
backs up a group of files with a single command.

D I R B : \ ? ? ? ? . *

Lists all the files on the B: drive that have exactly four
characters in the file name but have any extension.
The question mark substitutes for a single character.

R E N T E S T ? . B A T

T E S T ? . OL D

Renames all files having TEST for the first four
characters in the file name, followed by any single
character and the .BAT extension. The files retain the
same TEST? file name but gain the file extension OLD.
The ? can also be used to match a single specific
character in a file name.