January 13, 2009 by Vincent
Batch File Rename Without Using Software
I am not a fan of installing new softwares for every single task I want to perform on my computer. There are many softwares, both free and commercial, that will do batch or bulk files renaming, but the fact is, all you need is just a notepad (on Windows).
The only downside of this method of batch renaming files is that the number of characters of your file name must be exactly the same, before and after renaming. Meaning if you want to rename abc01.jpg, your new file name must be exactly of 5 characters. If you prefer otherwise, refer to this method.
In this example, I’ll show you how I rename my emoticons set from
1. Place the series of files you want to rename in a folder
2. Open Notepad, type the following:
ren icon_*.gif logo_*.gif
ren stands for rename, while the first file name is before renaming, and the second file name is what you want them to be renamed to.
The asterisk (*) acts as a wild card, meaning it can be anything. Denoting an asterisk in the command line above meaning the particular part of the file name can be anything and no need to be renamed.
In this case, I want to rename all my emoticons, from icon_biggrin to logo_biggrin, from icon_confused to logo_confused.
ren icon_*.gif logo_*.gif, it simply means rename all files in the folder that has an initial file name of icon_(anything).gif to logo_(anything).gif
3. After typing
ren icon_*.gif logo_*.gif in the Notepad, save it as
rename.bat to the folder where the files you want to rename is located.
In fact, you can name the file as anything you like, but it must end with a .bat extension. Make sure you select “All Files” in the “Save as type”, instead of “Text Documents (*.txt)“.
4. Double-click/Open the .bat file you have just saved.
5. Voila, it’s done. All my emoticons are now by the file name of logo_(anything).gif
How it actually works?
All the command line would do is replacing each character of the file name to a new one which you’ve specified. It cannot add a new character or deduct a character. In short, you can only use this to rename your files to a new name with the same amount of character.
It’s all about playing around with the wild card (*). Depending on how you want to rename your batch of files, you would manipulate the command line in Step 2. Here’s are 2 examples that may help you to understand better:
Rename DSC001.jpg, DSC002.jpg, DSC003.jpg to ESC001.jpg, ESC002.jpg, ESC003.jpg
Command line to use:
ren DSC00*.txt ESC00*.txt
Rename DSC001.jpg, DSC002.jpg, DSC003.jpg to john01.jpg, john02.jpg, john03.jpg
Batch renaming without considering the amount of character
If you prefer to batch rename a series of files to any name you desire, without considering the number of character of the previous file name:
- Highlight or Select all the files you want to rename.
- Press F2 or right-click any of them and select “Rename“.
- Type the new file name you desire and press “Enter”.
Using this method, your new file names will be numbered. Say you rename 3 files with different names to awesome-pic, your output file names would be awesome-pic, awesome-pic(2) and awesome-pic(3).