Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Changing filename extentions

by Fastolfe (Vicar)
on Jul 24, 2002 at 19:59 UTC ( [id://185006]=note: print w/replies, xml ) Need Help??


in reply to Changing filename extentions

Since you're renaming in the same directory, using File::Copy is overkill. The use of system is inefficient when Perl has a rename function built in, and using readdir for this purpose is probably unnecessary.
rename($_, lc($_)) foreach <*.HTM{,L}>; # yes, this is portable
I think it was Larry Wall that pushed a real simple command-line regex-based "rename" utility like this:
$op = shift or die "Usage: rename expr [files]\n"; chomp(@ARGV = <STDIN>) unless @ARGV; for (@ARGV) { $was = $_; eval $op; die if $@; rename($was, $_) unless $was eq $_; }
Which would let you run something like:
rename '$_ = lc' *.HTM *.HTML

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2025-06-24 04:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.