[ale] mv *.gif

George A. Nies gt0543b at prism.gatech.edu
Wed Apr 17 08:24:31 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.
> 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

or perhaps:

	#!/bin/ksh  
	for OLDNAME in *.$1 ;do
	    mv $OLDNAME ${OLDNAME%.*}.$2
	done






More information about the Ale mailing list