> I have to write a task that takes a group of directories convert 
> them to all lowercase (including filenames) and then zip them up. 

> something similar already or had any suggestions

Haha. In a past life when Perl scripts roamed more freely in my user
directory, I'd have done something like this already.

Perl can do an UPPER to lower translation, and the space to underscore
in one line. The following is an example:


#!/usr/local/bin/perl

use strict;
use POSIX;
use File::Copy;
use File::Basename;


my $line = "UPPER and Mixed Case\n";
print $line;
$line =~ tr/A-Z /a-z_/;
print $line;

# Some brute force copying with file rename:
chdir "D:/temp/input" or die "Can't chdir to D:/temp/input $!\n";

for my $file (<*>) {
 my $tofile = $file;
 $tofile =~ tr/A-Z /a-z_/;
 print "copying $file to $tofile\n";
   copy($file,"D:/temp/bak/${tofile}.bkp") or warn "Can not copy $tofile
$!\n";
}

But there is also a handy script here to do the recursion too:
http://www.blazonry.com/perl/recurse.php

Indeed - it looks like exactly what you need to do... just update the
regex, then use it to copy the source dirs to another directory and then
run Zip. :-)

Cheers,
Timo
P.S. I'd love to see a similar example using Groovy - this is the kind
of thing Groovy should be able to do, right?




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

Reply via email to