[Omaha.pm] Rename all files in a directory

Jay Hannah jhannah at omnihotels.com
Thu Sep 9 16:13:29 CDT 2004


Another 5 minute hack...

j

#!/usr/bin/perl

opendir DIR, ".";
@files = grep /^ppm/, readdir DIR;
closedir DIR;

foreach (@files) {
   $new = $_;
   $new =~ s/^ppm/its/;
   print "rename $_ $new\n";
   rename $_, $new;
}







More information about the Omaha-pm mailing list