Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Dec 1998 16:44:43 -0600
From:      Don Read <sysop@calcasieu.com>
To:        Patrick Seal <patseal@hyperhost.net>
Cc:        <freebsd-questions@FreeBSD.ORG>
Subject:   Re: lowercase filenames
Message-ID:  <3.0.5.32.19981230164443.008ece70@mail>
In-Reply-To: <Pine.BSF.4.05.9812301628490.866-100000@foobar.hyperhost.ne t>

next in thread | previous in thread | raw e-mail | index | archive | help
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



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