Neat utility to convert uppercase filenames
Rahul Dhesi
dhesi%cirrusl at oliveb.ATC.olivetti.com
Tue Dec 11 16:44:57 AEST 1990
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 at oliveb.ATC.olivetti.com>
UUCP: oliveb!cirrusl!dhesi
More information about the Alt.sources
mailing list