Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

HELP: shell script to change filenames to lower-case?

0 views
Skip to first unread message

WilsonCPU

unread,
Sep 19, 1997, 3:00:00 AM9/19/97
to

Does anyone know how to write a shell script to change all the filenames
in a directory to their lower-case values? I'm developing under Win95
(which rather capriciously capitalizes things), and FTPing the results to
SUN SOLARIS. Since WIn95 doesn't care about the capitalization, my
"standard" is that all filenames are assumed to be lower-case; since they
aren't when they get to the UNIX box, naturally my files fail to work
properly. If I can force them to lower-case after the FTP that'd be great.
Any ideas? Please email me at Wils...@aol.com - thanks!
(I know I'd use "mv", but I'm not sure how to (a) write the loop, and (b)
MOST important, how to do the conversion!
- Mark
--------------------------------
Mark A. Wilson
Computer Programming Unlimited
email: Wils...@aol.com
WWW: http://www.geocities.com/SiliconValley/6646

WilsonCPU

unread,
Sep 19, 1997, 3:00:00 AM9/19/97
to

Does anyone know how to write a shell script to change all the filenames
in a directory to their lower-case values? I'm developing under Win95
(which rather capriciously capitalizes things), and FTPing the results to
SUN SOLARIS. Since WIn95 doesn't care about the capitalization, my
"standard" is that all filenames are assumed to be lower-case; since they
aren't when they get to the UNIX box, naturally my files fail to work
properly. If I can force them to lower-case after the FTP that'd be great.
Any ideas? Please email me at Wils...@aol.com - thanks!

Warren Jones

unread,
Sep 19, 1997, 3:00:00 AM9/19/97
to

wils...@aol.com (WilsonCPU) writes:

> Does anyone know how to write a shell script to change all the filenames
> in a directory to their lower-case values?

#! /bin/ksh

typeset -l new

for file in *
do
new=$file
test "$file" != "$new" && mv -i $file $new
done

--------------------------------------------------------------------
Warren Jones | To keep every cog and wheel is the first
Fluke Corporation | precaution of intelligent tinkering.
Everett, Washington, USA | -- Aldo Leopold

Jeremy Mathers

unread,
Sep 21, 1997, 3:00:00 AM9/21/97
to

In article <19970919210...@ladder02.news.aol.com>,

WilsonCPU <wils...@aol.com> wrote:
>Does anyone know how to write a shell script to change all the filenames
>in a directory to their lower-case values? I'm developing under Win95
>(which rather capriciously capitalizes things), and FTPing the results to
>SUN SOLARIS. Since WIn95 doesn't care about the capitalization, my
>"standard" is that all filenames are assumed to be lower-case; since they
>aren't when they get to the UNIX box, naturally my files fail to work
>properly. If I can force them to lower-case after the FTP that'd be great.

Everyone else posts the standard shell script to lowercase the names; the
adventurous will post Perl or AWK solutions, but the real answers, in order,
are:
1) Read the FAQ
2) Read the FAQ!
3) Read the FAQ!!
4) Read the FAQ!!!
5) Use the 'case' command in FTP, which is designed to do exactly
what you need.

************************************************************************
... and we thank you for your support.

- py...@quads.uchicago.edu, who is still costing the net
hundreds, if not thousands, of dollars, every time he posts -
************************************************************************
rwvpf wpnrrj ibf ijrfer

Message has been deleted
Message has been deleted
0 new messages