Search : in
By :

Batch rename from a list

Last answer on Jun 17, 2009 3:48:26 pm BST dolsonlat, on Jun 12, 2009 9:11:13 pm BST 
 Report this message to moderators

Hello,
I am renaming a bunch of files from diffferent programs all in our drawing drive. The drive is U: I have built a list with the current names of the original file in one column and the rename in the other column. I want to create and run a batch file to do the renaming based on this list. Can anyone show me how to do this.
Example: change 478204_Rev A _ Redline to 478204_REVA_REDLINE. I will be renaming over one hundred files using this list.

Configuration: Windows XP Internet Explorer 7.0

Best answers for « Batch rename from a list » in :
Renaming multiple files in batch Show Renaming multiple files in batch Native features Using a third-party program Renaming a large number of files can quickly become tedious. Fortunately, there are tools to automate this task in many cases: Native features On Windows...
Unable to delete file: Argument list too long ShowUnable to delete file: Argument list too long Solutions Xargs Command find loop for (bash) Program Perl When trying to delete a file , you receive the following error message : bash: /bin/rm: Argument list too long This is...
Removing or renaming entries from GRUB menu ShowRemoving or renaming entries from GRUB menu What are entries Renaming/deleting entries GRUB boot manager,may contain unnecessary boot sequence.Here's is a small tip on how removing them. What are entries These are the lines of...
List of open ports in command line ShowList of open ports in command line Whether you're running Windows or Linux / Unix, the following command in (console) will display the list of open ports on your computer: netstat -a For the use of advanced graphics tools, see What...

1

 SenHu, on Jun 17, 2009 3:48:26 pm BST
  • +1

Hello dolsonlat:

You have a file that lists old name and new name for each file to be renamed. The first column contains the old name, the second, the new name. (Make sure column are separated by tabs.) I will assume the list is stored in C:/list.txt. The following biterscript ( http://www.biterscripting.com ) will do the trick.


set $wsep="\r\n\t"
var str list ; cat "C:/list.txt" > $list
while ($list <> "")
do
var str old_name, new_name
wex "1" $list > $old_name ; wex "1" $list > $new_name
system rename ("\""+$old_name+"\"") ("\""+$new_name+"\"")
done

Email me if you need more help.

Sen

Reply to SenHu