#!/sw/bin/perl
#######################
# By: Ventz Petkov    #
# Date: 6-22-05       #
# Massive File Rename #
#######################
if (@ARGV != 2) {
    print "\t\tUsage: ./mmv.pl from_extension to_extension\n";
    print "\t\tEx: ./mmv.pl txt pl\n"; exit();
}

$from = ".".$ARGV[0]; $to = ".".$ARGV[1];
use Cwd; $dirname = cwd();

opendir(DIR, $dirname) or die "Can't opendir $dirname: $!";
while( defined($file = readdir DIR) ) {
    $oldfile = $file;
    substr($file, 0, length($file)) =~ s/$from/$to/g;
    rename($oldfile, $file);
}
closedir(DIR);
