[Omaha.pm] Rename all files in a directory

Hugh Jarce hjarce2001 at yahoo.com
Thu Sep 9 18:43:12 CDT 2004


Jay Hannah wrote:
> 
> 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;
> }

Great minds think alike. A certain larry also solved this problem
with a little Perl script (not sure if he did it in less than
five minutes though ;-):

<http://iis1.cps.unizar.es/Oreilly/perl/cookbook/ch09_10.htm>
<http://www.csit.fsu.edu/~burkardt/pl_src/rename/rename.html>
<http://www.faqs.org/faqs/unix-faq/faq/part2/section-6.html>

h



		
__________________________________
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail 


More information about the Omaha-pm mailing list