[comp.unix.programmer] CHANGING file names

kyung@uhccux.uhcc.Hawaii.Edu (Kyung Lee) (12/12/90)

	Hi everyone, since unix is case sensitive, I'm having some
	problem with file names...small and CAPs.

	Has anyone ever come up with a program that renames all the
	files in a directory from small letter to CAPs??
	Well, if there is anyone out there who did, drop me
	an e-mail.  Thanx.

-----
kyung@uhunix.uhcc.Hawaii.Edu
kyung@uhccvx.BITNET

tchrist@convex.COM (Tom Christiansen) (12/12/90)

From: Tom Christiansen <tchrist@convex.COM>
Newsgroups: comp.unix.programmers
Subject: Re: CHANGING file names - (small to CAPITOL)
Summary: 
References: <10617@uhccux.uhcc.Hawaii.Edu>
Reply-To: tchrist@convex.COM (Tom Christiansen)
Followup-To: 
Distribution: usa
Organization: CONVEX Software Development, Richardson, TX
Keywords: small to CAPs

In article <10617@uhccux.uhcc.Hawaii.Edu> kyung@uhccux.UUCP (Kyung Lee) writes:
:	Hi everyone, since unix is case sensitive, I'm having some
:	problem with file names...small and CAPs.

This is a feature.

:	Has anyone ever come up with a program that renames all the
:	files in a directory from small letter to CAPs??

That's not the way most people want it changed, you know.  Who
wants all those ugly capitals anyway?  

On the other hand, the poster was looking to changing to capitols.  
He might try:

    mv * /usa/washington-dc/

or some similar incantation.

:	Well, if there is anyone out there who did, drop me
:	an e-mail.  Thanx.

Sheesh, doesn't anyone read the Frequently Asked Questions list
anymore???  There are also a bunch of big, ugly, grody C hacks in
alt.sources on this right now, plus a small, elegant, generic perl
solution as well. :-)

Look around.

--tom
--
Tom Christiansen		tchrist@convex.com	convex!tchrist
"With a kernel dive, all things are possible, but it sure makes it hard
 to look at yourself in the mirror the next morning."  -me

josef@nixpbe.nixdorf.de (josef Moellers) (12/14/90)

In <110800@convex.convex.com> tchrist@convex.COM (Tom Christiansen) writes:

>In article <10617@uhccux.uhcc.Hawaii.Edu> kyung@uhccux.UUCP (Kyung Lee) writes:
>:	Hi everyone, since unix is case sensitive, I'm having some
>:	problem with file names...small and CAPs.

>This is a feature.

>:	Has anyone ever come up with a program that renames all the
>:	files in a directory from small letter to CAPs??

>That's not the way most people want it changed, you know.  Who
>wants all those ugly capitals anyway?  

Try
% for file in *
> do cap=`echo $file | tr '[a-z]' '[A-Z]'`
> mv $file $cap
> done
%

--
| Josef Moellers		| c/o Siemens Nixdorf Informationssysteme AG |
|  USA: mollers.pad@nixdorf.com	| Abt. STO-XS 113			     |
| !USA: mollers.pad@nixdorf.de	| Heinz-Nixdorf-Ring			     |
| Phone: (+49) 5251 104662	| D-4790 Paderborn			     |

mercer@npdiss1.StPaul.NCR.COM (Dan Mercer) (12/22/90)

In article <josef.661159919@ugum01> josef@nixpbe.nixdorf.de (josef Moellers) writes:
:In <110800@convex.convex.com> tchrist@convex.COM (Tom Christiansen) writes:
:
:>In article <10617@uhccux.uhcc.Hawaii.Edu> kyung@uhccux.UUCP (Kyung Lee) writes:
:>:	Hi everyone, since unix is case sensitive, I'm having some
:>:	problem with file names...small and CAPs.
:
:>This is a feature.
:
:>:	Has anyone ever come up with a program that renames all the
:>:	files in a directory from small letter to CAPs??
:
:>That's not the way most people want it changed, you know.  Who
:>wants all those ugly capitals anyway?  
:
:Try
:% for file in *
:> do cap=`echo $file | tr '[a-z]' '[A-Z]'`
:> mv $file $cap
:> done
:%
:
:--
:| Josef Moellers		| c/o Siemens Nixdorf Informationssysteme AG |
:|  USA: mollers.pad@nixdorf.com	| Abt. STO-XS 113			     |
:| !USA: mollers.pad@nixdorf.de	| Heinz-Nixdorf-Ring			     |
:| Phone: (+49) 5251 104662	| D-4790 Paderborn			     |

There is a far more efficient method:

<set -- `echo * | tr "[a-z]" "[A-Z]"`
<for i in *
<do
<mv $i $1
<shift
<done

This eliminates the need to load tr for each and every file

-- 
Dan Mercer
NCR Network Products Division      -        Network Integration Services
Reply-To: mercer@npdiss1.StPaul.NCR.COM (Dan Mercer)
"MAN - the only one word oxymoron in the English Language"