Controlled Batch Rename Files

How to batch rename files:

Put a batch file named “List Files With Subs.bat” with the code of:

@echo off
DIR /B /O:N /S > filename.txt

into the folder with the files I want to rename in it and run it (by double clicking). It produces a text file (filename.txt) that lists of all of the files in the folder. (note that the List file with subs writes a list of ALL the files with the sub directories in the folder including itself and filename.txt, so I’d suggest deleting those 2 entries, alternativly if you wish to print a list of the files without the subs, use “List Files Without Subs.bat” instead)

Then copy/paste the list and paste it into an excel document , let’s say starting in cell B1. (Column B, Row 1)

in the cell to the right of it (cell C1), type in what you want the file to be named, for this example I’ll rename pictures to “Disney 1.jpg”, “Disney 2.jpg” by putting this in:

=”Disney “&ROW()&”.jpg”

And dragging the bottom right corner of cell C1 (where the cursor changes to a thiner + symbol) down to match the last item on the list. This takes the text in quotes in this case Disney  (including the following space) and combines it with the row that the current cell is in. (convent that I started with row 1 ;) ) Now to produce functional batch code that renames the files as desired

In cell D1 type this in:

=”rename “&”"”"&B1&”"”"&” “&”"”"&C1&”"”"

it should read as something like this:

rename “C:\Users\Username\Desktop\New folder\001.JPG” “Disney 1.jpg”

Now drag cell D1 down in the same fashion as before to match the last item on the list. The row you just created is the usable batch code to rename your files. To run it, simply highlight column D then copy and paste the code into a batch file, save and run it.

2 Comments

  1. At last! Soemhting clear I can understand. Thanks!

Leave a Comment