home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Source Code 1992 March
/
Source_Code_CD-ROM_Walnut_Creek_March_1992.iso
/
usenet
/
altsrcs
/
2
/
2254
< prev
next >
Wrap
Internet Message Format
|
1990-12-28
|
1KB
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
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 <dhesi%cirrusl@oliveb.ATC.olivetti.com>
UUCP: oliveb!cirrusl!dhesi