Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Renaming Files

by Shendal (Hermit)
on Feb 19, 2003 at 19:49 UTC ( #236786=note: print w/replies, xml ) Need Help??


in reply to Renaming Files

I strongly recommend File::Find. Here's an example of what it might look like:
use File::Find; my $dir = shift || '.'; find \&wanted, $dir; sub wanted { next unless (-f && /\.cfm$/); my $newname = $File::Find::name; $newname =~ s/\.cfm$/.html/; rename $File::Find::name,$newname or die "Unable to rename $File::F +ind::name!"; }

Cheers,
Shendal

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://236786]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2021-10-27 17:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (94 votes). Check out past polls.

    Notices?