From owner-freebsd-questions Wed Dec 30 14:45:27 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id OAA10595 for freebsd-questions-outgoing; Wed, 30 Dec 1998 14:45:27 -0800 (PST) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from fir.calcasieu.com (fir.calcasieu.com [209.99.46.67]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id OAA10590 for ; Wed, 30 Dec 1998 14:45:26 -0800 (PST) (envelope-from sysop@calcasieu.com) Received: from ns (cruft.austin.calcasieu.com [192.168.170.124]) by fir.calcasieu.com (8.8.8/8.8.8-2.0) with SMTP id QAA20782; Wed, 30 Dec 1998 16:44:32 -0600 (CST) Message-Id: <3.0.5.32.19981230164443.008ece70@mail> X-Sender: sysop@mail X-Mailer: QUALCOMM Windows Eudora Light Version 3.0.5 (32) Date: Wed, 30 Dec 1998 16:44:43 -0600 To: Patrick Seal From: Don Read Subject: Re: lowercase filenames Cc: In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG back on 04:34 PM 12/30/98 -0500, you said: >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) #!/bin/sh for old in *[A-Z]* do new=`echo "$old" | tr "[A-Z]" "[a-z]"` mv $old $old.tmp if [ -f "$new" ] then echo backup $new "->" $new.bak mv $new $new.bak fi echo $old "->" $new mv $old.tmp $new done Regards, -- Don Read sysop@calcasieu.com EDP Manager dread@texas.net Calcasieu Lumber Co. Austin TX - Ya jes' mash that button, rite jher To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message