Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Dec 1998 21:59:05 +0000
From:      Ben Smithurst <ben@scientia.demon.co.uk>
To:        Patrick Seal <patseal@hyperhost.net>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: lowercase filenames
Message-ID:  <19981230215905.A2517@scientia.demon.co.uk>
In-Reply-To: <Pine.BSF.4.05.9812301628490.866-100000@foobar.hyperhost.net>
References:  <Pine.BSF.4.05.9812301628490.866-100000@foobar.hyperhost.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Patrick Seal wrote:

> I have a directory with filenames like:
> FOO.xxx
> Bar.yyy
> hex.zzz 
> 
> What would be the easiest way to convert them to lowercase (and possibly
> checking for existing lowercase counterparts before overwriting them)

a shell script, of course :-)

for i in *; do
	j=`echo "$i" | tr 'A-Z' 'a-z'`
	if [ -e $j ]; then
		echo "warning: $j already exists, not renaming $i"
	else
		mv -f "./$i" "./$j"
	fi
done

-- 
Ben Smithurst
ben@scientia.demon.co.uk

send a blank message to ben+pgp@scientia.demon.co.uk for PGP key

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19981230215905.A2517>