Navigation:  Best Practices & FAQ's > FAQs >

Batch Renaming of Files

Previous pageReturn to chapter overviewNext page

1.List existing file paths

Open ‘command’ window (Start | Run | ‘cmd’ <enter>)

 

Change to root of folders / files to be recorded, i.e. J:\12300\123456-00

 

Enter command ‘dir /s /b *.dgn > c:\tmp\list.txt’ <enter>.  This will create a TXT file listing the full path for all DGN files found beneath this location.

 

Enter ‘Exit’ <enter> to close command window.

 

2.Manipulate data in excel

Start Excel

 

Open file c:\tmp\list.txt.

 

Text import wizard will appear;

oStep 1: leave as ‘delaminated’

oStep 2; Leave delimiters as ‘tab’

oStep 3, Change column data format to ‘text’

 

Remove any erroneous/unwanted rows of data that is not needed (i.e. *.dgnlib, etc).

 

Copy Column A to Column B.

 

Insert column in front of Column A

 

Enter row syntax to perform appropriate task, i.e.

oMOVE ( ‘move /ypath|filename1path)

oRENAME( ‘renamepath|filename1filename2’)

oCOPY( ‘copypath|filename1path|filename2’)

 

Edit column C to suit syntax of command detailed above

 

Save to XLS file for future reference

 

Save ‘As | Tab Delimited’ TXT file

 

Example:

RENAME                C:\TMP\FILE1.DGN                C:\TMP\FILE2.DGN

 

3.Run BAT file

Rename file extension of  TXT file to ‘BAT’

 

Double click BAT file to perform operation

 


Direct link to this topic:

© 2013 Arup