From owner-freebsd-questions Wed Dec 30 15:27:22 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id PAA14680 for freebsd-questions-outgoing; Wed, 30 Dec 1998 15:27:22 -0800 (PST) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from smtp1.vnet.net (smtp1.vnet.net [166.82.1.31]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id PAA14620 for ; Wed, 30 Dec 1998 15:27:20 -0800 (PST) (envelope-from rivers@dignus.com) Received: from dignus.com (ponds.vnet.net [166.82.177.48]) by smtp1.vnet.net (8.9.1a/8.9.1) with ESMTP id SAA10320; Wed, 30 Dec 1998 18:27:09 -0500 (EST) Received: from lakes.dignus.com (lakes.dignus.com [10.0.0.3]) by dignus.com (8.9.1/8.8.5) with ESMTP id TAA17769; Wed, 30 Dec 1998 19:10:47 -0500 (EST) Received: (from rivers@localhost) by lakes.dignus.com (8.9.1/8.6.9) id SAA05953; Wed, 30 Dec 1998 18:28:04 -0500 (EST) Date: Wed, 30 Dec 1998 18:28:04 -0500 (EST) From: Thomas David Rivers Message-Id: <199812302328.SAA05953@lakes.dignus.com> To: billh@finsco.com, patseal@hyperhost.net Subject: Re: lowercase filenames Cc: freebsd-questions@FreeBSD.ORG In-Reply-To: <368AA5C5.4A8FAD46@finsco.com> Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Bill Hamilton writes: > You could write an awk script, making use of the tolower function. > It could use mv -i or whatever. > > > 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) > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message > Or - you can use this small shell script; which I think came out of Unix Review years ago. I call it "filename.fix", and use it as: cd filename.fix | sh -x filename.fix doesn't actually run the commands; but prints them to its stdout - so you can validate them... You could add to this the code to do the checking you desire... - Dave Rivers - #!/bin/sh # ------- filename.fix ----------------- /bin/ls $* >/tmp/XX$$ tr '[A-Z]' '[a-z]' < /tmp/XX$$ > /tmp/YY$$ echo 'set -v' paste /tmp/XX$$ /tmp/YY$$ | sed 's/^/mv /' rm -f /tmp/XX$$ /tmp/YY$$ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message