"Renaming Multiple files through DOS commands"
Hey guys..!!
Today i am going to show you "How to rename Multiple files with the help of DOS and Ms Excel"
After reading this blog you will be aware about some cool formulas of MS Excel as well as commands of DOS..
so step by step lets start..
1) I have created 28 dummy files in the following location.
C:\Documents and Settings\abhishek\Desktop\BLOG\For Blog\
picture1
2) For renaming all of these,we need to make a list of these files.so for doing that..Click on "start" button and find "run" window and type "cmd" to open a command prompt.
picture 2
okey now the Command Prompt opens like this..
picture 3
3) Now on the command prompt we have to paste the path of the folder where all the dummy files is being stored
and the command will be like this:- CD C:\Documents and Settings\abhishek\Desktop\BLOG\For Blog
picture 4
4) So we find the folder location..Now for making the list of these files, type the following Command..
dir /b>FileList.txt
What this Command does, It will make list of all files stored in this folder and save that list in a new txt file,
the name of this file will be "FileList"
Picture 5
5) Now you will find that there is a txt file "FileList" created on the same location.
picture 6
6) If we open this Txt file it looks like this...
picture 7
7) How cool is that !!
Now copy all the list from the "FileList file" and Open a new MS Excel sheet and paste the list like this..
picture 8
8) Now here we have to make rename command for all the files
so the syntax is
ren "file name with location path" "new name"
now in this case the code will be like this..
ren "C:\Documents and Settings\abhishek\Desktop\BLOG\For Blog\
note:- i add a slash at the end and not close the inverted commas
now paste this code in the previous cell (before the list column)
picture 9
9) the command is not completed yet..
our first file is "1 (10).txt" and i want to rename this as "dummyFile001"
so the complete command will be..
ren "C:\Documents and Settings\abhishek\Desktop\BLOG\For Blog\1 (10).txt" DummyFile001.txt
so that means we have to add " DummyFile001.txt at the end.
and all file names starting with LS i want to change their name as " LogicSimplified001.txt
paste this on the column H paste " DummyFile001 and on column I paste .txt
picture 10
10) now Drag the content of column F G H and I upto the end of the list..You will Notice that the
file name will automatically change as we drag down
Picture 11
11) Our command is ready but it is saperated among different cells..We have to join our commands
for this write the following formula on Column E row 3rd
=F3&G3&H3&I3
this will join the command together.Now drag the formula upto the end of the list..
Picture 12
COOL..!!
12) Now copy this column "Column E" and open a new Txt file and paste..
Picture 13
Now choose save as option and name the file as "rename.bat" (with inverted commas as we are making bat file)
picture 14
13) So the bat file is being created....run the bat file and see the mazic....
picture 15
aaahaan !!! we changed the name of all files..
IF this is helpful for you....do like and comment.. ;)
0 Comment(s)