Lesson#141: Master method to rename all files in a folder at once using Excel

This one is really a master method. Now I will show you a master method to rename all files in a folder at once using Excel. I am sure this solution is going to ease your huge workload at the office.

Here I have shown a folder where I am having some files. I need to rename all files in the folder. I am going to use command prompt with excel to do that.

Press the Windows logo button + R and type cmd and press Enter. Command Prompt window will appear.


Copy the folder path of the folder and again go to CMD.

There you have to go to the parent drive as I have typed
C:\Users\Puspendu>e:
You will be in the drive. Now you write there. If you are having a lower version of Windows like Windows 7 then you can’t paste directly by Ctrl+V
You have to write click on the header bar of CMD and go to Edit>Paste
E:\>cd<SPACE><FOLDER PATH>
Like I have entered
E:\>cd E:\New Folder
And you will be in the folder and you write there dir>dir.txt to export all list of files and folders in a .txt file.

Copy the necessary part from the notepad and paste into an excel sheet.

Now select the column and go to DATA>Text to Columns. Select Fixed Width and go to Next there you set the break lines and click Next and Finish.
Creating the command.


Now I have to form the new file name for each of the files and the command to rename those files.

I have created a formula to make the command. To rename a file in the directory from Command Prompt, this is the generic command.
ren<SPACE>”oldfilename”<SPACE>”newfilename”
Example: ren “oldname.txt” “newname.txt”

Then I will select the whole column and paste it into Command Prompt.

It is done now. Now see the folder. All files are renamed at once.

Read more.
Lesson#101: Make hyperlink of all files and folders in worksheet within a minute
Leave a Reply