Tel 678.697.4783
Fax 678.840.7870
Po Box 4432
Marietta, Ga 30061
info@jamboconsulting.com

 Subscribe in a reader



Lunarpages.com Web Hosting
Web hosting by ICDSoft

Archives

Previous Posts

Powered by Blogger

Saturday, April 18, 2009

Bulk Rename Script

Awesome little script to do bulk rename of files posted on MandrivaUsers.org by Steve Scrimpshire.


#!/usr/bin/perl -w
# rename - Larry's filename fixer
$op = shift or die "Usage: rename expr [files]\n";
chomp(@ARGV = ) unless @ARGV;
for (@ARGV) {
$was = $_;
eval $op;
die $@ if $@;
rename($was,$_) unless $was eq $_;
}


Create a new file in /usr/bin rename.pl with the above contents.

chmod +x /usr/bin/rename.pl

Now you can do something like this to bulk rename files:

rename.pl 's/[0-9]+-//g' *

This requires some knowledge of Regular Expressions.


bulk rename bash script - MandrivaUsers.org

Article Link posted by Edward at 4:59 AM

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home