*BSD News Article 83284


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!howland.erols.net!vixen.cso.uiuc.edu!news.stealth.net!newsfeed.uk.ibm.net!news-m01.ny.us.ibm.net!newsjunkie.ans.net!newsfeeds.ans.net!jpmorgan.com!usenet
From: "H.S. Prasad 4-8398" <hprasad>
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: 20 Nov 1996 14:37:51 GMT
Organization: JP Morgan
Lines: 39
Message-ID: <56v53v$jbi@hardcopy.ny.jpmorgan.com>
References: <01bbd5d3$54b9d060$86629dcc@big-one>
NNTP-Posting-Host: deda01.ny.jpmorgan.com
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 1.1N (X11; I; SunOS 4.1.3_U1 sun4m)
X-URL: news:01bbd5d3$54b9d060$86629dcc@big-one
Xref: euryale.cc.adfa.oz.au comp.infosystems.www.servers.unix:22149 comp.unix.bsd.freebsd.misc:31312 comp.unix.programmer:46615 comp.unix.questions:91654

Perl script to do this:

#!/usr/local/bin/perl
# This program will recursively go thro' subdirectories
# and convert the file names to lower case
 
$dir="/export/home/hprasad/PERL";
&renamefiles($dir, $dir);
 
sub renamefiles() {
local($dirnm, $oldir) = @_;
 
local $fls;
 
opendir(DIR, $dirnm) or die("Unable to open $dirnm because $!");
local(@files)=sort(readdir(DIR));
closedir(DIR);
chdir($dirnm);
foreach $fls (@files) {
      next if((substr( $fls, 0, 1)) eq "\.");
     (-d $fls)? &renamefiles($fls, $dirnm) : rename($fls, (lc("$fls")));
}
chdir($oldir);
 
}
 
__END__

-Prasad

"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
>