[ale] mv *.gif
Alexander Barton
alex at cad.gatech.edu
Tue Apr 16 13:09:09 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.
>
> Try the following. It convert
>
> #!/usr/local/bin/zsh
> # $1 is the file or pattern to convert
> for OLDNAME in $1; do
> BASE=`basename $OLDNAME .gif`
> NEWNAME=$BASE.$2
> mv $OLDNAME $NEWNAME
> echo $OLDNAME converted to $NEWNAME.
> done
> --
> Vernard Martin
How about:
#!/bin/sh
for OLDNAME in *.$1; do
BASE=`basename $OLDNAME .$1`
NEWNAME=$BASE.$2
mv $OLDNAME $NEWNAME
done
Use it like:
$ ./convert gif GIF
-Alexander
More information about the Ale
mailing list