[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Omaha.pm] Rename all files in a directory



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