[ale] mv *.gif
Dan Newcombe
newcombe at aa.csc.peachnet.edu
Tue Apr 16 15:13:29 EDT 1996
> > > How do I change the extension on a bunch of files. I tried mv *.gif =
> > > *.GIF but I get an error message. I'm sure someone has done this in =
> > > unix.
Personally I use what's at the end. That way I can use any perl
expression. For the gif example:
rename s/gif/GIF/ *.gif
#!/usr/bin/perl
#usage: rename perl_expression [files]
($op=shift) || die "Usage: rename perl_expression [filenames]\n";
if (!@ARGV) {
@ARGV = <STDIN>;
chop(@ARGV);
}
for (@ARGV) {
$was = $_;
eval $op;
die $@ if $@;
rename($was,$_) unless $was eq $_;
--
Dan Newcombe - Clayton State College - User Services - 770-961-3421
newcombe at aa.csc.peachnet.edu http://www.csc.peachnet.edu/home/dan/
- Safe in my own words, learning from my own words, Cruel joke,
cruel joke. (Marillion, Pseudo Silk Kimono)
More information about the Ale
mailing list