How to do mv *.xyz *.abc in shell script??
Tom Christiansen
tchrist at convex.COM
Sat Sep 8 02:33:28 AEST 1990
I still like this one (from the FAQ):
#!/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' *
$op = shift;
for (@ARGV) {
$was = $_;
eval $op;
die $@ if $@;
(rename($was,$_) || warn "$0: can't rename $was to $_: $!\n")
if $was ne $_;
}
--
"UNIX was never designed to keep people from doing stupid things, because
that policy would also keep them from doing clever things." [Doug Gwyn]
More information about the Comp.unix.shell
mailing list