Posted by Elisabeth on April 11, 2008 at 10:06:09:
In Reply to: DOS Rename help posted by Donna on September 18, 2007 at 05:47:09:
: Hi I am trying to rename files thru dos but I need it to rename to a unique filename to cater for duplicate files which need to be saved for analysis. Is there a way I can get it to rename with incremental number?
: thanks
: Donna
This isn't an automatic fix, but it works:
Read the directory into a text file
dir > txt.txt
Import the text file into Excel and strip off the front of the directory junk using Data>Text to Columns>Fixed Width
That will give you a column with the current file name
Make a new column with the numbered file name
Write a formula to write the batch file commands
="ren "&A1"&" "&"B1
where A1 is original and B1 the new file name
Copy formula down the lenght of the files list
Paste the generated code into the batch file and run