Skip to content

Instantly share code, notes, and snippets.

@jgornick
Created December 9, 2008 19:35
Show Gist options
  • Save jgornick/34051 to your computer and use it in GitHub Desktop.
Save jgornick/34051 to your computer and use it in GitHub Desktop.
Terminal Perl Based Rename Script
#!/usr/bin/perl -w
# rename
$op = shift or die "Usage: rename expr [files]n";
chomp (@ARGV = <STDIN>) unless @ARGV;
for (@ARGV) {
$was = $_;
eval $op;
die $@ if $@;
rename ($was,$_) unless $was eq $_;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment