Friday, February 10, 2012

Creating set of folders for test data with specific IDs

I have been given 150 ID and was told to create folders matching already existing folders for some other IDs. The IDs are to be used as a test data and the folder must exist for each ID to be valid.
I took some time to think how to do this efficiently and in a smart way saving time and effort, and I thought of something to be done
First I went to the ID folder that I already have, did select all, then copy and past several times at the same location, this will create multiples of this folder depending on how times you do select all, copy, past. No of end folders = 2^n, then I adjusted the number so that I have 150 only
Screenshot-2012-02-11_00.16.49
Now I have 150 folder but with incorrect names, Next I should rename to my IDs
Second I opened command prompt, went to that folder that contains the 150 folder, typed dir command and set the output to text file
dir /w >temp.txt
Screenshot-2012-02-11_00.24.57
No I have a text file containing the 150 folder name, the temp names
Third, I opened excel, and in blank sheet, first column I entered “ren “, second row I pasted the 150 temp folder names, third column I pasted the IDs, fourth cell I concatenated all the previous cells. Make sure to replace [ , ] with “
Screenshot-2012-02-11_00.36.29
No I have 150 rename command from the old temp folder names to the new IDs
Last, I selected  the 150 ren command, copied them, then in the command prompt, I did a right click then selected past. The 150 ren command will be executed
Screenshot-2012-02-11_00.42.17
Now, I have my 150 folder for my 150 ID created in a smart and efficient way
Screenshot-2012-02-11_00.42.30


Of course there are other ways to do this, like later, I did a small program to create folders just with one click.