Two wildcards are allowed: an asterisk (*), which is
Table 2-2. What happens when you try to rename multiple files in Explorer
Old filename New filename
My file.doc (the active file) The Penske File.rtf
Grandma.jpg The Penske File (1).jpg
Readme.1st The Penske File (2).1st
Purchases.mdb The Penske File (3).mdb
Chapter 2 (a folder) The Penske File (4)
70 | Chapter 2: Shell Tweaks
used to match any number of characters, and a question mark (?), which
is used to match only a single character. For example:
Rename a single file
ren oldfile.txt newfile.txt
Change the extension of all .txt files to .doc
ren *.txt *.doc
Rename the first part of a filename without changing the extension
ren document.* documentation.*
Remove the extensions of all files in the folder
ren *.* *.
Change the first letter of all files in a folder to ???b???
ren *.* b*.*
Add a zero in front of numbered chapter files (note the quotation marks)
ren "chapter ??.wpd" "chapter0??.wpd"
Rename all files with an ???s??? in the fourth position so that a ???t??? appears there
instead
ren ???s*.* ???t*.*
Truncate the filenames of all files in the folder so that only the first four characters
are used
ren *.* ????.*
Now, using wildcards takes a bit of practice and patience. The more you do
it, the better intuitive sense you??™ll have of how to phrase a rename operation.
To make things simpler, try issuing several successive ren commands
instead of trying to squeeze all your changes into a single step.
Pages:
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120