Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: rename files in directory with new extenstion

by Hofmator (Curate)
on Aug 09, 2001 at 18:29 UTC ( [id://103412]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/perl -w
    # rename - Larry's filename fixer
    $op = shift or die "Usage: rename expr [files]\n";
    ...
        die $@ if $@;
        rename($was,$_) unless $was eq $_;
    }
    
  2. or download this
    % rename 's/\.orig$//'  *.orig
    % rename 'tr/A-Z/a-z/ unless /^Make/'  *
    % rename '$_ .= ".bad"'  *.f
    % rename 'print "$_: "; s/foo/bar/ if <STDIN> =~ /^y/i'  *
    % find /tmp -name '*~' -print | rename 's/^(.+)~$/.#$1/'
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (8)
As of 2024-04-18 12:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found