[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ale] Renaming many files (prefix-trim)
- Subject: [ale] Renaming many files (prefix-trim)
- From: fletch at phydeaux.org (Fletch)
- Date: 28 Jun 2000 21:14:38 -0400
From the examples that come with perl . . .
#!/usr/bin/perl -w
# rename - Larry's filename fixer
$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 $_;
}
Usage:
rename 's/^...//' foo*
--
Fletch | "If you find my answers frightening, __`'/|
fletch at phydeaux.org | Vincent, you should cease askin' \ o.O'
678 443-6239(w) | scary questions." -- Jules =(___)=
| U
--
To unsubscribe: mail majordomo at ale.org with "unsubscribe ale" in message body.