scripts

misc scripts and tools
git clone git://git.2f30.org/scripts.git
Log | Files | Refs

rename (292B)


      1 #!/usr/bin/perl -w
      2 # rename - Larry's filename fixer
      3 # recursive renaming: `rename 's/one/two/g' */*`
      4 $op = shift or die "Usage: rename expr [files]\n";
      5 chomp(@ARGV = <STDIN>) unless @ARGV;
      6 for (@ARGV) {
      7     $was = $_;
      8     eval $op;
      9     die $@ if $@;
     10     rename($was,$_) unless $was eq $_;
     11 }