[ale] mv *.gif

Vernard Martin vernard at cc.gatech.edu
Tue Apr 16 12:40:43 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

Name it "convert" and then use it like 
"convert list-of-file-to-convert new extension" for example "convert *.gif GIF"

-- 
Vernard Martin
(vernard.martin at cc.gatech.edu) http://www.cc.gatech.edu/people/home/vernard/
College of Computing, Georgia Institute of Technology, Atlanta, GA 30332






More information about the Ale mailing list