*BSD News Article 83203


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!ns.saard.net!news.camtech.net.au!news.adelaide.on.net!news.ade.connect.com.au!news.mel.connect.com.au!munnari.OZ.AU!spool.mu.edu!uwm.edu!math.ohio-state.edu!jussieu.fr!oleane!plug.news.pipex.net!pipex!tube.news.pipex.net!pipex!soap.news.pipex.net!pipex!lade.news.pipex.net!pipex!dish.news.pipex.net!pipex!caspian.cursci.co.uk!usenet
From: Michael Smith <mjs@cursci.co.uk>
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: Tue, 19 Nov 1996 14:57:54 +0000
Organization: Electronic Press Ltd
Lines: 30
Message-ID: <3291CAF2.13F7C0E5@cursci.co.uk>
References: <01bbd5d3$54b9d060$86629dcc@big-one> <Pine.LNX.3.91.961119142024.2275A-100000@boqueron.vnet.es>
NNTP-Posting-Host: s50p8.cursci.co.uk
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 3.01 (X11; I; Linux 2.0.0 i586)
Xref: euryale.cc.adfa.oz.au comp.infosystems.www.servers.unix:22103 comp.unix.bsd.freebsd.misc:31252 comp.unix.programmer:46547 comp.unix.questions:91546

Francisco Rodrigo wrote:
> 
> Hello.
> 
> On 19 Nov 1996, Erotic Delirium 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.
> 
> That problem seems too familiar for me...
> 
> > (no joke)
> 
> Indeed.
> 

Here's a bit of perl code to convert everything in a directory to
lowercase.  I think it could easily be modified to be recursive, or else
could be combined with find ...

#!/usr/local/bin/perl
$dir = $ARGV[0];
$dir = "." unless $dir;
opendir(DIRHANDLE,$dir);
foreach $in (grep(!/^\.\.?$/,readdir(DIRHANDLE)))
        {
        $out="\L$in";
        die unless rename("$dir/$in","$dir/$out");
        }