-
-
Save chrismacdermaid/493c539e53d72c825e797b67c7e5e14d to your computer and use it in GitHub Desktop.
Revisions
-
trammell revised this gist
Jul 18, 2011 . 1 changed file with 2 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,12 +8,9 @@ if (!@ARGV) { chomp(@ARGV); } for (@ARGV) { $old_name = $_; eval $regexp; die $@ if $@; rename($old_name, $_) unless $old_name eq $_; } -
trammell created this gist
Jul 18, 2011 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ #!/usr/bin/perl # Usage: rename perlexpr [files] ($regexp = shift @ARGV) || die "Usage: rename perlexpr [filenames]\n"; if (!@ARGV) { @ARGV = <STDIN>; chomp(@ARGV); } foreach $_ (@ARGV) { $old_name = $_; eval $regexp; die $@ if $@; rename($old_name, $_) unless $old_name eq $_; } exit(0);