AutoCAD 2013/2014/2015

Reply
*Expert Elite*
Patchy
Posts: 6,301
Registered: ‎09-16-2009
Message 1 of 12 (693 Views)
Accepted Solution

Rename a file

693 Views, 11 Replies
08-14-2013 07:07 AM

Hi all,

Does anyone know if there is a program that can rename a new file to match another file name (They are in 2 different folders)

 

What I have is hundreds of PDF files and I have to rename each of them to match the name of an existing file in another folder. Retyping the names is killing me. I hope to find a program to click on one to match another.

 

Any suggestion that can help would be good.

 

Thanks

 

 

Following on from 3wood, I have done this before using the DOS Rename command and Excel to create a .bat file.

1st Stage: You need to get a list of the drawings that you want to rename, the easiest way is to open Notepad and add this line DIR *.DWG /B > DWGlist.csv save this file as DRG_LIST.BAT. Copy to the folder containing the drawings you want to rename and in Windows Explorer double click on the file DRG_LIST.BAT, this will create a file DWGlist.csv, double click on this file and it will open in Excel. You can also use the DOS prompt to run the DIR command.

2nd Stage: In Excel you now have a row containing the existing drawing files names. In the second row add the row of names you want these drawings to be renamed too. In the third row use the formula  ="RENAME " & CHAR(34) & A1 & CHAR(34) & " " & CHAR(34) &  B1 & CHAR(34) and drag down into the other cells. See attached example Excel file. The part CHAR(34) adds a semicolon into the formula allowing you to rename files with a space in the name.

3rd Stage: Open Notepad and Copy/Paste the third row into it, Next save this file as DRG_LIST_Rename.BAT and in Windows Explorer copy it to the folder containing the set of drawings you want to rename, double click on this file and it will quickly rename all the files for you.

 

I would advise you to back up the files into another folder before you start.

 

Patrick
http://www.multi-batch.com/ 
For your entire batch processing needs

Valued Mentor
AcadAdamLT
Posts: 493
Registered: ‎12-14-2010
Message 2 of 12 (684 Views)

Re: Rename a file

08-14-2013 07:18 AM in reply to: Patchy

Don't know of such a program, heres a fast way of doing it tho!

 

Open both file locations and place the windows bordering to each other.

Click the old file that you want to copy the name of, click the following keys:

f2, ctrl-C.

Click the new file that you want to rename:

f2, ctrl-V.

Easy and fast.

 

(f2 standard windows shortcutkey for renaming)

Signature, sincerely... //Adam
AutoCad LT 2014
Give Kudos where credit is due, Mark "accepted as solution" if the post solved your question.
*Expert Elite*
rkmcswain
Posts: 3,584
Registered: ‎11-13-2006
Message 3 of 12 (677 Views)

Re: Rename a file

08-14-2013 07:23 AM in reply to: Patchy

So you have files like "PDF1.pdf", "PDF2.pdf", "PDF3.pdf", and you want to rename those to something like "MyNewFile1.pdf", "MyNewFile2.pdf", "MyNewFile3.pdf", etc...?

 

If so, then Irfanview will do it.

 

 

*Expert Elite*
Patchy
Posts: 6,301
Registered: ‎09-16-2009
Message 4 of 12 (672 Views)

Re: Rename a file

08-14-2013 07:27 AM in reply to: rkmcswain

They have radom names and I have the RENAMER program so it doesn't work that good.

I have been doing the method that Adam's suggested, painfull.

*Expert Elite*
Patchy
Posts: 6,301
Registered: ‎09-16-2009
Message 5 of 12 (663 Views)

Re: Rename a file

08-14-2013 07:44 AM in reply to: AcadAdamLT

Thank you for your suggestion.

(I had been renaming them your way,  I'm hoping for a lazier way :smileyvery-happy:)

*Expert Elite*
3wood
Posts: 1,129
Registered: ‎03-25-2009
Message 6 of 12 (643 Views)

Re: Rename a file

08-14-2013 11:05 AM in reply to: Patchy

When switching between Windows, use Alt+Tab to save you mouse moving time. Also, use Arrow key to move down to next file instead of using mouse.

 

The other way is using a routine to do it. You need create two csv files as the filename list of each folders (either by lisp or Windows DIR command, then copy one list into another as the second column in Excel. Save new file as a combined csv file. Create a routine to read this csv file, repeat each line, read the first file name and locate the second file based on the second filename and then rename it.

 

If the folder contains thousand of files, or it is a routine task, it is worth to create such lisp routine.

There is some programs avaiable to mimic keyboard/mouse movment, if the editing procedure is fixed, you can try such program as well.

*Expert Elite*
Patchy
Posts: 6,301
Registered: ‎09-16-2009
Message 7 of 12 (626 Views)

Re: Rename a file

08-14-2013 12:45 PM in reply to: 3wood

Good tip on that Alt+Tab

 

 

 

Mentor
PatrickByrne
Posts: 167
Registered: ‎10-06-2010
Message 8 of 12 (609 Views)

Re: Rename Multiple files

08-14-2013 08:42 PM in reply to: Patchy

Following on from 3wood, I have done this before using the DOS Rename command and Excel to create a .bat file.

1st Stage: You need to get a list of the drawings that you want to rename, the easiest way is to open Notepad and add this line DIR *.DWG /B > DWGlist.csv save this file as DRG_LIST.BAT. Copy to the folder containing the drawings you want to rename and in Windows Explorer double click on the file DRG_LIST.BAT, this will create a file DWGlist.csv, double click on this file and it will open in Excel. You can also use the DOS prompt to run the DIR command.

2nd Stage: In Excel you now have a row containing the existing drawing files names. In the second row add the row of names you want these drawings to be renamed too. In the third row use the formula  ="RENAME " & CHAR(34) & A1 & CHAR(34) & " " & CHAR(34) &  B1 & CHAR(34) and drag down into the other cells. See attached example Excel file. The part CHAR(34) adds a semicolon into the formula allowing you to rename files with a space in the name.

3rd Stage: Open Notepad and Copy/Paste the third row into it, Next save this file as DRG_LIST_Rename.BAT and in Windows Explorer copy it to the folder containing the set of drawings you want to rename, double click on this file and it will quickly rename all the files for you.

 

I would advise you to back up the files into another folder before you start.

 

Patrick
http://www.multi-batch.com/ 
For your entire batch processing needs

*Expert Elite*
Patchy
Posts: 6,301
Registered: ‎09-16-2009
Message 9 of 12 (566 Views)

Re: Rename Multiple files

08-15-2013 06:10 AM in reply to: PatrickByrne

Use old DOS, that's it.

 

Mentor
PatrickByrne
Posts: 167
Registered: ‎10-06-2010
Message 10 of 12 (527 Views)

Re: Rename Multiple files

08-18-2013 09:52 PM in reply to: Patchy

The trick is to put the DOS commands in a Bat file and run them through Windows Explorer. This saves you having to open the DOS Command Prompt and navigate through the folders using the CD (Change Directory) command.

 

Excel can also be used for writing scripts. For example if you have a lot of drawings and you need to fill in the title block you can set it up in Excel to open the drawing and fill in the Title Block.

 

Patrick
http://www.multi-batch.com/
For your entire batch processing needs

 

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!