"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![alt text](https://lh6.googleusercontent.com/-0asn57kUqlc/UqVPSoBVecI/AAAAAAAAABM/z6t5-KlNO9s/w774-h602-no/1.jpg)
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
![](https://lh4.googleusercontent.com/-tNGtudbVvo8/UqVPWhnQhkI/AAAAAAAAACA/Voqu_i7L4eI/w347-h179-no/2.jpg alt=)
okey now the Command Prompt opens like this..
picture 3
![](https://lh4.googleusercontent.com/-WDOxBEOV7qs/UqVPW8AeQOI/AAAAAAAAACQ/0LAI1kRDXaU/w668-h141-no/3.jpg)
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
![](https://lh5.googleusercontent.com/-Rn1NL1dka3c/UqVPXi4azJI/AAAAAAAAACg/bk5ifVz6gTo/w668-h121-no/4.jpg)
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
![](https://lh5.googleusercontent.com/-2yY3Z_t0H54/UqVPXi6RRtI/AAAAAAAAACY/6KHSuiWRPls/w668-h171-no/5.jpg)
5) Now you will find that there is a txt file "FileList" created on the same location.
picture 6
![](https://lh4.googleusercontent.com/-BpXtiybe3P8/UqVPYqM9IWI/AAAAAAAAACw/QJwsFmHo1Cs/w784-h618-no/6.jpg)
6) If we open this Txt file it looks like this...
picture 7
![](https://lh4.googleusercontent.com/-2jX4tvFOTEw/UqVPYup1_dI/AAAAAAAAACo/rUiE83h2q-4/w273-h455-no/7.jpg)
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
![](https://lh3.googleusercontent.com/-8-22v7bCpIg/UqVPZO7CtzI/AAAAAAAAAC0/G3f0SSXVJtA/w546-h706-no/8.jpg)
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
![](https://lh6.googleusercontent.com/-8dCNYTenH-A/UqVPZ1ma8XI/AAAAAAAAAC8/T9gfaNkOSKs/w1024-h768-no/9.jpg)
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
![](https://lh5.googleusercontent.com/-H4TrBAMWUro/UqVPTnK6YwI/AAAAAAAAABU/6PRJ-dMRdg0/w1024-h768-no/10.jpg)
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
![](https://lh6.googleusercontent.com/-pZGnV-T2cwU/UqVPU6WWkPI/AAAAAAAAABg/AOKu2PUqGbc/w1024-h768-no/11.jpg)
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
![](https://lh5.googleusercontent.com/-EO8ilUrSr58/UqVPV6lVEYI/AAAAAAAAAB4/IgwRiHS3Xd0/w1024-h768-no/12.jpg)
COOL..!!
12) Now copy this column "Column E" and open a new Txt file and paste..
Picture 13
![](https://lh5.googleusercontent.com/-U4uI56UMfF8/UqVPVUnn_5I/AAAAAAAAABo/3fSanZCz4AQ/w791-h663-no/13.jpg)
Now choose save as option and name the file as "rename.bat" (with inverted commas as we are making bat file)
picture 14
![](https://lh5.googleusercontent.com/-kz5p7BNfgkU/UqVPWSBbZ-I/AAAAAAAAAB8/pIV1o2xEHdI/w890-h726-no/14.jpg)
13) So the bat file is being created....run the bat file and see the mazic....
picture 15
![](https://lh6.googleusercontent.com/-g5mufZ6z1VM/UqVPWX_2k6I/AAAAAAAAACI/UuKsW3V9axk/w752-h626-no/15.jpg)
aaahaan !!! we changed the name of all files..
IF this is helpful for you....do like and comment.. ;)
0 Comment(s)