Path: utzoo!utgpu!cs.utexas.edu!usc!julius.cs.uiuc.edu!apple!olivea!tymix!cirrusl!sunstorm!dhesi From: dhesi%cirrusl@oliveb.ATC.olivetti.com (Rahul Dhesi) Newsgroups: alt.sources Subject: Re: Neat utility to convert uppercase filenames Message-ID: <2797@cirrusl.UUCP> Date: 11 Dec 90 05:44:57 GMT References: <76@gdx.UUCP> Sender: news@cirrusl.UUCP Organization: Cirrus Logic Inc. Lines: 38 I think all the programs posted so far have the bug that if you have files called "x" and "X", they will delete one of them. Here's mine. Doesn't disturb files whose names already contain any lowercase characters (thus preserving names like "Makefile"), and even has online help! Not shar'd, cut out and use. #! /bin/sh # converts to lowercase if test $# -lt 1; then echo "usage: lfname file ..." echo "(specified filenames are converted to lowercase)" exit 1 fi 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 exit 0 -- Rahul Dhesi UUCP: oliveb!cirrusl!dhesi