Return to BSD News archive
Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!news.ecn.uoknor.edu!feed1.news.erols.com!hunter.premier.net!www.nntp.primenet.com!nntp.primenet.com!howland.erols.net!news3.cac.psu.edu!news.math.psu.edu!news.cse.psu.edu!rutgers!news.new-york.net!wlbr!news.cerf.net!hacgate2.hac.com!sbdsk0838.sbrc.hac.com!user
From: eraugust@igate1.hac.com (Eric R. Augustine)
Newsgroups: comp.infosystems.www.servers.unix,comp.unix.bsd.freebsd.misc,comp.unix.programmer,comp.unix.questions
Subject: Re: Help Need a UTIL for Case Sensitive Files.
Date: Wed, 20 Nov 1996 09:48:46 -0800
Organization: HAC
Lines: 63
Message-ID: <eraugust-2011960948460001@sbdsk0838.sbrc.hac.com>
References: <01bbd5d3$54b9d060$86629dcc@big-one>
NNTP-Posting-Host: 147.21.65.10
Xref: euryale.cc.adfa.oz.au comp.infosystems.www.servers.unix:22171 comp.unix.bsd.freebsd.misc:31351 comp.unix.programmer:46651 comp.unix.questions:91695
In article <01bbd5d3$54b9d060$86629dcc@big-one>, "Erotic Delirium"
<kelly@eroticd.com> wrote:
> does anyone have a utility that will go through and change filenames &
> directories from uppercase to lower case. I need to change everything in a
> certian directory including subdirs to lowercase and its about 9000 files.
> (no joke)
> --
> Kelly
I have a chunk of C code which whill change a string from upper case to
lower case which I use here at work to do a similar task (on directories
of roughly the same size btw):
---
/** mklower.c - take a string and make all upper case letters lowercase
**
** (C)1996 Eric R. Augustine
**
** compile with "cc -o mklower mklower.c"
**
**/
#include <stdio.h>
#include <ctype.h>
int main(argc,argv)
int argc;
char **argv;
{
if(argc == 1)
return -1;
for(;putc(tolower(*argv[1]++),stdout) != '\0';);
return 0;
}
---
In combination with the following bourne script you should be able to do what
you need:
---
#!/bin/sh
for FILE in *
do
NAME=`./mklower $FILE`
if [ ! -f $NAME ]
then
mv $FILE $NAME
fi
done
exit 0
---
With 9000 files you might have to modify the script to hit wildcards since
a listing of 9000 file names would probably excede the length of line limit
on your system.
I hope this helps --
--Eric.
gort@impulse.net.