[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Uppercasing filenames



On Sun, 2003-09-21 at 02:57, Michael D Schleif wrote:
> Jeff Elkins <jeffelkins@earthlink.net> [2003:09:20:17:06:26-0400] scribed:
> > I need to convert a bunch of filenames to uppercase. I tried the script below, 
> > which does...nothing.
> > 
> > #!/bin/sh
> > for file in $*
> >  do
> >  if [ -f $file ]
> >  then
> >   ucfile=`echo $file | tr [a-z] [A-Z]`
> >   if [ $file != $ucfile ]
> >   then
> >   mv -i $file $ucfile
> >   fi     
> >  fi
> >  done
> > 
> > Any tips?
> 
> for mds in *
> do
> mv $mds `echo $mds | tr [:lower:] [:upper:]`
> done
> 
> for mds in *
> do
> mv $mds `echo $mds | tr a-z A-Z`
> done

Use two dashes(--) after specifying any parameters to mv,
and enclose variables in quotes.



 ------------------------------------------------------------------
| I keep on working for the same reason a hen keeps on laying eggs.|
 ------------------------------------------------------------------

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: