From owner-freebsd-questions Wed Dec 30 15:54:47 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id PAA17737 for freebsd-questions-outgoing; Wed, 30 Dec 1998 15:54:47 -0800 (PST) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from scientia.demon.co.uk (scientia.demon.co.uk [212.228.14.13]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id PAA17731 for ; Wed, 30 Dec 1998 15:54:44 -0800 (PST) (envelope-from ben@scientia.demon.co.uk) Received: from ben by scientia.demon.co.uk with local (Exim 2.10 #3) id 0zvTdy-00025a-00; Wed, 30 Dec 1998 21:59:06 +0000 Date: Wed, 30 Dec 1998 21:59:05 +0000 From: Ben Smithurst To: Patrick Seal Cc: freebsd-questions@FreeBSD.ORG Subject: Re: lowercase filenames Message-ID: <19981230215905.A2517@scientia.demon.co.uk> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95i In-Reply-To: Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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