home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Source Code 1992 March
/
Source_Code_CD-ROM_Walnut_Creek_March_1992.iso
/
usenet
/
altsrcs
/
2
/
2285
< prev
next >
Wrap
Internet Message Format
|
1990-12-28
|
1KB
From: flint@gistdev.gist.com (Flint Pellett)
Newsgroups: alt.sources
Subject: Re: Neat utility to convert uppercase filenames
Message-ID: <1034@gistdev.gist.com>
Date: 10 Dec 90 19:44:11 GMT
jay@gdx.UUCP (Jay A. Snyder) writes:
>Did you ever do mget from simtel20 or ymodem batch downloads from an MSDOS
>BBS, and get a lot of uppercase files in your directory?
>Well this is a utility that will take all specified files and convert
>them to lower case.
>One exception is that trailing .Z's will be left uppercase
Rather a bit of overkill to write a C program for it isn't it?
The script below, hacked out in about 30 seconds, does most of what
want-- adding an -if- to check for the trailing .Z files is left
as an exercise for the reader :-). You can also add a check for
a $1 that was already all lower case if you want.
#!/bin/ksh
while [ -n "$1" ]
do
typeset -l LC="$1"
mv "$1" "${LC}"
shift
done
I suppose I should offer a (slower) Bourne shell version for
anyone unlucky enough to still be limited to that: I'm
sure someone can probably improve on this and make it even
shorter. (You can probably write it in perl in 1 line.)
#!/bin/sh
while [ "$1" != "" ]
do
mv $1 `echo $1 | tr "[A-Z]" "[a-z]"`
shift
done
--
Flint Pellett, Global Information Systems Technology, Inc.
1800 Woodfield Drive, Savoy, IL 61874 (217) 352-1165
uunet!gistdev!flint or flint@gistdev.gist.com