Community
AutoCAD Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Rename a file

11 REPLIES 11
SOLVED
Reply
Message 1 of 12
Patchy
6836 Views, 11 Replies

Rename a file

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

 

 

11 REPLIES 11
Message 2 of 12
AcadAdamLT
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 2016
Give Kudos where credit is due, Mark "accepted as solution" if the post solved your question.
Message 3 of 12
rkmcswain
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.

 

 

R.K. McSwain     | CADpanacea | on twitter
Message 4 of 12
Patchy
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.

Message 5 of 12
Patchy
in reply to: AcadAdamLT

Thank you for your suggestion.

(I had been renaming them your way,  I'm hoping for a lazier way Smiley Very Happy)

Message 6 of 12
3wood
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.

Message 7 of 12
Patchy
in reply to: 3wood

Good tip on that Alt+Tab

 

 

 

Message 8 of 12
PatrickByrne
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

Message 9 of 12
Patchy
in reply to: PatrickByrne

Use old DOS, that's it.

 

Message 10 of 12
PatrickByrne
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

 

Message 11 of 12
nmulder34
in reply to: PatrickByrne

Wow, what a time saver! Thank you Patrick!

 

I am undertaking renaming our detail library according to CSI format. Your instructions worked so well on a single folder naturally I wonder if this process can be modified and used on sub-folders. So, for example, if I have 10 folders with files in them, rather than creating the .bat files for 10 folders is it possible to do the same process you outlined on all 10 folders at once? (the file path contained in the .bat for the file name to be renamed essentially)

 

Thanks!

Message 12 of 12
PatrickByrne
in reply to: nmulder34

By adding /S to the DIR command it lists all the drawings in the subfolders as well. DIR *.DWG /S /B > DWGlist.csv. That is the easy part

 

When you open this file in Excel you now have the file name and the folder address all in one cell. You are going to have to separate the file name from the folder address using the Text to Columns command. Because the folder address varies the file name will be in different columns. You can use the sort command to move them all into one. I would then recreate a column with the folder address plus a column with the old names and one with the new names.

 

After you have this re-join them and using the rename command.

 

It sounds hard but if you take your time and be careful it should work out. As always create a backup in case it goes wrong.

 

Patrick

http://www.multi-batch.com/

For your entire batch processing needs

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost