Return to Snippet

Revision: 7845
at August 17, 2008 09:03 by iblis


Initial Code
#!/usr/bin/env perl -w
use strict;

# Batch rename files with Perl regex substitutions
# Perl administration files rename
#
# Larry Wall's filename fixer: recipe 9.9 in Perl Cookbook 

$op = shift 
	or die "Usage: $0 expr [files]\n";
chomp(@ARGV = <STDIN>) unless @ARGV;
for (@ARGV) {
    $was = $_;
    eval $op;
    die $@ if $@;
    rename($was, $_) unless $was eq $_;
}

Initial URL

                                

Initial Description

                                

Initial Title
Batch rename files with Perl regex substitutions

Initial Tags
files

Initial Language
Perl