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 icon_something.gif to logo_something.gif:

1. Place the series of files you want to rename in a folder

Emoticons - icon_something

2. Open Notepad, type the following: ren icon_*.gif logo_*.gif

Type in Notepad

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.

For 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.

Rename.bat

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.

Open rename.bat

5. Voila, it’s done. All my emoticons are now by the file name of logo_(anything).gif

logo_(anything)

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:

Situation 1
Rename DSC001.jpg, DSC002.jpg, DSC003.jpg to ESC001.jpg, ESC002.jpg, ESC003.jpg

Command line to use: ren DSC00*.txt ESC00*.txt

Situation 2
Rename DSC001.jpg, DSC002.jpg, DSC003.jpg to john01.jpg, john02.jpg, john03.jpg

Command line to use: ren DSC0*.jpg john*.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:

  1. Highlight or Select all the files you want to rename.
  2. Press F2 or right-click any of them and select “Rename“.
  3. Type the new file name you desire and press “Enter”.
  4. Voila!

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).

#command line#ms-dos#rename#tips

Comments

  1. Lee - January 7, 2010 @ 11:24 pm

    This is a funny way but it seems a little bit complex. May we test a small software such as Rename Now. I have used it. Very simple, only click several bottoms.

    Reply

  2. Mike - May 3, 2010 @ 11:21 pm

    I have used this method before, but just from the command prompt. No need to open notepad and make a batch file.
    .-= (MikeĀ“s blog – Send Email From A Batch File) =-.

    Reply

  3. Dean - July 26, 2012 @ 7:21 am

    How do I get it to rename files also in any sub-folders?

    Reply

  4. Dean - July 26, 2012 @ 7:42 am

    I think this BAT works for sub-folders…

    for /r %%x in (FILENAME*.jpg) do ren “%%x” FILENAME*.jpg

    Reply

  5. Paul - November 30, 2012 @ 1:36 pm

    Good work! I have tried it and it works… Thanks!

    Reply

Leave a Reply

Your email address will not be published / Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>