Neat utility to convert uppercase filenames
Tom Christiansen
tchrist at convex.COM
Sat Dec 8 14:40:18 AEST 1990
Here's one version of rename, a generic utility to
perform infinite contortions on your filenames. It's
surely more powerful than anything of its ilk I've
ever seen before.
--tom
#!/usr/bin/perl
#
# rename script examples from lwall:
# rename 's/\.orig$//' *.orig
# rename 'y/A-Z/a-z/ unless /^Make/' *
# rename '$_ .= ".bad"' *.f
# rename 'print "$_: "; s/foo/bar/ if <stdin> =~ /^y/i' *
#
# shows good use of eval operator
$op = shift;
for (@ARGV) {
$was = $_;
eval $op;
die $@ if $@;
rename($was,$_) unless $was eq $_;
}
--
Tom Christiansen tchrist at convex.com convex!tchrist
"With a kernel dive, all things are possible, but it sure makes it hard
to look at yourself in the mirror the next morning." -me
More information about the Alt.sources
mailing list