Path: utzoo!utgpu!attcan!uunet!ginosko!gem.mps.ohio-state.edu!apple!oliveb!tymix!cirrusl!sun505!dhesi From: dhesi@sun505.UUCP (Rahul Dhesi) Newsgroups: comp.unix.wizards Subject: Re: HELP converting filenames! Message-ID: <952@cirrusl.UUCP> Date: 8 Oct 89 03:29:27 GMT References: <9234@pyr.gatech.EDU> <5003@omepd.UUCP> <9754@cadnetix.COM> <1983@convex.UUCP> Sender: news@cirrusl.UUCP Reply-To: dhesi%cirrusl@oliveb.ATC.olivetti.com (Rahul Dhesi) Organization: Cirrus Logic Inc. Lines: 35 In article <1983@convex.UUCP> tchrist@convex.COM (Tom Christiansen) writes: >I second the "shame on you"; lwall's rename script posted in reponse to >this subject thread was the most powerful, yet small and elegant, such >thing that the I've ever seen. #! /bin/sh # converts filenames to lowercase without zapping mixed-case names # -- Rahul Dhesi, Oct 1989 # (powerless, big-gish, inelegant, but *portable-ish*) for f in "$@" do case "$f" in *[a-z]*) #echo "skipping $f, contains lowercase chars" ;; *) newname=`echo "$f" | tr 'A-Z' 'a-z'` if test "$newname" != "$f" then if test -f "$newname" then echo "$newname already exists" else mv "$f" "$newname" fi fi ;; esac done By the way, those intellectually inclined may want to find the one significant remaining bug in the above script. Rahul Dhesi UUCP: oliveb!cirrusl!dhesi