[OT] Changing the case of filenames

Robert P. J. Day rpjday at mindspring.com
Fri Apr 29 14:14:09 UTC 2005


On Fri, 29 Apr 2005, David Niemi wrote:

> > David Niemi wrote:
> > > I am running a fortran program which requires all input file
> > > names to be uppercase.  As things were originally done in
> > > Windo$e all the filenames are mixed case (with numbers).
> > >
> > > Searching around I came across the "tr" command, but my difficulty comes
> > > in trying to use this from the command line (or even in a bash script).
> On Fri, 2005-29-04 at 14:45 +0100, Paul Howarth wrote:
> > You could use a script like this one:
> >
> > #!/bin/sh
> > for f in *
> > do
> >          F="`echo $f | tr a-z A-Z`"
> >          echo Renaming \"$f\" to \"$F\"
> > 	mv "$f" "$F"
> > done
>
> Thanks for all the VERY FAST responses everyone.  As just about all
> the responses were variants of the same thing I'll be going with
> Paul's suggestion, I was about 1/2 way there in my feeble attempts
> at writing a bash script for this.  I'll probably spruce it up a bit
> for more general usage as a general script to change case of file
> names.

another solution is to just not re-invent the wheel:

http://osx.freshmeat.net/projects/css-cameronsimpsonsscripts/

rday




More information about the users mailing list