Date: Wed, 30 Dec 1998 18:28:04 -0500 (EST) From: Thomas David Rivers <rivers@dignus.com> To: billh@finsco.com, patseal@hyperhost.net Cc: freebsd-questions@FreeBSD.ORG Subject: Re: lowercase filenames Message-ID: <199812302328.SAA05953@lakes.dignus.com> In-Reply-To: <368AA5C5.4A8FAD46@finsco.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Bill Hamilton <billh@finsco.com> 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 <dir>
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199812302328.SAA05953>
