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]