Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 2 Jan 1999 17:01:31 -0600 (CST)
From:      Don Read <sysop@calcasieu.com>
To:        gjb@acm.org (Greg Black)
Cc:        <patseal@hyperhost.net>, freebsd-questions@FreeBSD.ORG
Subject:   Re: lowercase filenames
Message-ID:  <9901022301.AA21324@oak.austin.calcasieu.com>
In-Reply-To: <19990101145824.16515.qmail@alice.gba.oz.au> from "Greg Black" at Jan 2, 99 00:58:23 am

next in thread | previous in thread | raw e-mail | index | archive | help
> 
> 
> What if $old.tmp exists?
> 
> What if $new.bak exists?
> 

All too true, a first whack at the script; proto-code = proto-think.

> 
> 
> #!/bin/sh
> for old in *[A-Z]* ; do
>   new=$(echo $old | tr A-Z a-z)
>   [ -e $new ] && echo - $new already exists || ( set -x ; mv $old $new )
> done
> 

not portable

#!/bin/sh
for old in *[A-Z]*
do
	new=`echo "$old" | tr "[A-Z]" "[a-z]"`
	mv -i $old $new
done

# 'course in rev .3 might wish to check for directories & specials ... 

;>

Regards,
-- 
 Don Read                                    sysop@calcasieu.com
 EDP Manager                                     dread@texas.net
 Calcasieu Lumber Co.                                  Austin TX
 -- Will sysadmin for food

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?9901022301.AA21324>