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