The current directory notation in Windows is also ".", but I'd be interested
to see if Windows will let you do it that way, since to the OS "MyDir",
"MYDIR", and "mydir" are all the same name.  If you are using Windows you
might end up having to do it in two steps; one changing the name to a
temporary name, and another changing it to lowercase.

-----Original Message-----
From: Michael Kelly
To: [EMAIL PROTECTED]
Sent: 2/28/02 9:58 PM
Subject: Re: Chaning case

On 2/28/02 9:33 PM, Daniel Falkenberg <[EMAIL PROTECTED]> wrote:

> G'day All,
> 
> Quick question I want to be able to change all folders in a directory
to
> lower case?  Does any one know how I could do this using Perl?
> 
> Would I go something like this?
> 
> system('lc *');
> 
> well something like that... :)
> 
> Regards,
> 
> Dan

This seems a bit like a job for a shell script (I remember seeing one
that
did just that once), but here's a script that changes all the files in
the
current dir to lowercase:

##### CODE #####

#!/usr/bin/perl -w
use strict;

opendir(CWD,".");
my @files = readdir(CWD);
closedir(CWD);

foreach my $file (@files){
    my $lcfile = lc($file);
    print "$file -> $lcfile\n";
    rename($file,$lcfile);
}

##### END CODE #####

That should work on a *nix system. (the name passed to opendir() would
be
":" on a Mac, and I'm-not-sure-what on Windows).

Hope that helps,
-- 
Michael


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--------------------------------------------------------------------------------
This email may contain confidential and privileged 
material for the sole use of the intended recipient. 
If you are not the intended recipient, please contact 
the sender and delete all copies.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to