diff options
Diffstat (limited to 'eg/rename')
-rw-r--r-- | eg/rename | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/eg/rename b/eg/rename new file mode 100644 index 0000000000..1708d35def --- /dev/null +++ b/eg/rename @@ -0,0 +1,13 @@ +#!/usr/bin/perl + +($op = shift) || die "Usage: rename perlexpr [filenames]\n"; +if ($#ARGV < 0) { + @ARGV = <stdin>; + chop(@ARGV); +} +for (@ARGV) { + $was = $_; + eval $op; + die $@ if $@; + rename($was,$_) unless $was eq $_; +} |