moving upper case names to lower case

Keith Gabryelski ag at cbmvax.UUCP
Thu Aug 24 03:02:23 AEST 1989


In article <9326 at chinet.chi.il.us> john at chinet.chi.il.us (John Mundt) writes:
>In article <20672 at adm.BRL.MIL> Leisner.Henr at xerox.com (Marty) writes:
>>I'm looking for a good, clean way to move files from upper case names to
>>lower case names.
>>
>>i.e. FOO.C to foo.c
>
>#include <stdio.h>
>#include <ctype.h>
>
>main()
>{
>	register int c;
>	while ((c = getchar()) != EOF)
>		putchar(tolower(c));
>}
>
>It's easier to write and compile this than to get tr to massage
>the string for you.  

Observe.

(the bourne shell)

$ for i in * ; do mv $i `echo $i | tr '[A-Z]' '[a-z]'` ; done

Or:

$ find . -type f -print | 
> while read filename
> do
>       mv $filename `echo $filename | tr '[A-Z]' '[a-z]'`
> done

Your code didn't solve any complex problem.  The only thing removed
from the above two commands is:

	tr '[A-Z]' '[a-z]'

and it would be replaced the name of the program you gave above (possibly
called 'mybrokentrwhichdoesnottakearguemnts' or maybe 'tolower').

On top of it all your solution would take compile time.

Pax, Keith
-- 
 "It took no computation to dance to the rock 'n roll station" -- Lou Reed
  ag at cbmvax.commodore.com     Keith M. Gabryelski      ...!uunet!cbmvax!ag



More information about the Comp.unix.questions mailing list