Excel and Dos rename

June 3, 2010 at 05:09:05
Specs: Windows XP
Hi all
I need to rename a number of files. I have a list in excel with the old file ( 01 HCK01.tif ) name and in the next colomn the new file name ( File 01.tif )

The rename command is: =CONCATENATE("rename ",I2," """,J2,"""")

When I copy and paste this command into Dos into the correct folder and drive, it says "The syntax of the command is incorrect."

Is this becasue it has a leading '01' at the beginning of the file name? Are there any ways around this?

Please any help would be greatly appreciated..

See More: Excel and Dos rename

June 3, 2010 at 06:28:30
When I use that function in Excel I get:

rename 01 HCK01.tif "File 01.tif"

I believe you need quotes around the original filename also:

=CONCATENATE("rename "," """,I2,""""," """,J2,"""")

rename "01 HCK01.tif" "File 01.tif"

P.S. I have a VBA macro for renaming files in XP that doesn't involve a list in a spreadsheet or pasting anything into DOS. The code does it all right within the folder.

If you are interested in seeing that, I could try and modify it to fit your filename structure, but I would need a few examples of "old names" and "new names" to set it up correctly.

Report •

June 3, 2010 at 06:40:13

Can't be sure - but it looks like the original file name: 01 HCK01.tif has a space in it. As a result you will need to enclose it in double quotes.

The new file name looks OK - no reason why a filename starting with a number won't work.


Report •

June 3, 2010 at 07:07:52
Thanks a lot, saved me some time and angst. It was the double quotes.

DerbyDad03: thanks for the VBA offer but I have to do this every so often on different jobs so the names are always changing but thanks for the help regardless. Much appreciated!

Report •
Related Solutions

Ask Question