Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
How can i mass rename files in a batch.
Example:
*.* (everything in the folder is renamed)
$$$$$1.lol (everything in the folder is renamed to this with a counter somewhere to prevent duplication errors)So "file.txt" is renamed to "$$$$$1.lol","file2.txt" is renamed to "$$$$$2.lol", "file3.txt" is renamed to "$$$$$3.lol" and, "file4.txt" is renamed to "$$$$$4.lol"...
How can I do this?

Are you talking about using the DOS command 'rename' or writing a program to do this for you.
RENAME
IF all the filenames are the same length and are already numbered ie (file1.txt file2.txt file3.txt) or (abcd1.txt defg2.txt ghij3.txt) you can use use the command and syntax
rename *?.* name?.lol or
rename *?.* name?.lolThe first 4 characters will be replace with n, a, m, e, and the fifth character (the number) will be retained by the ?
file1.txt becomes name1.lol file2.txt becomes name2.lol abcd3.txt become name3.lol
Luckily rename will not allow a second file to overwrite a previously renamed file thus file1.txt and abcd1.txt both exist but abcd1.txt cannot be renamed as name1.lol because file1.txt already is renamed that.If the names have double digits you want to save (old11.txt old12.txt you need to go *?? to retain the last two characters in the new name.
rename *??.txt new??.lol
The number of characters must be the same though in the old name and new name. If you have file names like abc.txt and asdf4.xyz and you want to rename them all to newname1.lol then newname2.lol no such luck that I am aware of, but then its been a long time since Iused dos regularly.

Have a look at:
LMOD
Versatile line/list modification tool to generate lists of commands, set variables to anything extracted from (DOS) output, and more.. Win NT/2000 compatible.
DEC 2002At URL: http://home.mnet-online.de/horst.muc/
This gem will enable you to take a
Dir *.* /b>dlist.txt
type of list, and pipe it through LMOD to produce a BATchfile which could rename as you require.
LMOD provides some powerful control over which parts of which words in the input file are used, so a bit of a play with LMOD should have you up and away.Baldy.

![]() |
Full screen dos??
|
DOS and WINXP
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |