Paulo,

  The following script works nicely to do many transformations on
  filenames.  In your case, invoke as:

    rename 'tr/A-Z/a-z/' *


#! /usr/bin/perl
#
# rename perlexpr [files]
#
#   from "Programming Perl" by Larry Wall and Randall Schwartz, p309.
#
# Examples:
#   rename '\.bak$//' *.bak     # strips the .bak extension
#   rename 's/$/.bak/' *        # adds it back on
#   rename 'tr/A-Z/a-z/' *      # map to lower case
#   find . -print | rename 's/readme/README/i'

($op = shift) || die "Usage: rename perlexpr [files]\n";
if ([EMAIL PROTECTED]) {
        @ARGV = <STDIN>;
        chop(@ARGV);
}

for (@ARGV) {
        $was = $_;
        eval $op;
        die $@ if $@;
        rename($was, $_) unless $was eq $_;
}
        




-- 

Bill Wohler <[EMAIL PROTECTED]>
Say it with MIME.  Maintainer of comp.mail.mh and news.software.nn FAQs.
If you're passed on the right, you're in the wrong lane.

Reply via email to