[SunHELP] Change upper case to lower case letter

Steffen Grunewald sunhelp at sunhelp.org
Fri Jun 1 06:32:48 CDT 2001


On Fri 2001-06-01 (12:49), Trond Eirik Aune wrote:
> Hi
>=20
> I have a directory structure with files and folder all in upper case le=
tter. I want to change all this to lower case letter.

Something like this? Wrote it years ago, so please no nitpicking - never
change a running script :-)


#!/bin/csh
foreach i (`find $1 -name '*[A-Z]*' -depth -print`)
	set b=3D`basename $i | tr '[A-Z]' '[a-z]'`
	set d=3D`dirname $i`
	echo $i $d/$b
	mv $i $d/$b
end


a -depth search is important, otherwise you would rename a directory befo=
re
cd'ing into it.

Steffen, of course sh is smaller and faster, exercise for the reader :)

--=20
 Steffen Grunewald | GFZ | PB 2.2 | Telegrafenberg E3 | D-14473 Potsdam
 =BB email: steffen(at)gfz-potsdam.de | fax/fon: +49-331-288-1266/-1245 =AB
 If at first you don't succeed, then you're in good company. - Lincoln



More information about the SunHELP mailing list