Igor Sutton Lopes wrote:
> Sorry! I was testing and sent the last version -TextMate integrated 
> with Mail.app- :-(
> 
> On Apr 10, 2007, at 4:40 PM, John W. Krahn wrote:
> 
>> [...]
>> Did you test this?  Where do you distinguish between files "older 
>> than 3 days"
>> and other files?  Where is "name('trunk')" specified by the OP?
> 
> The correct answer:
> 
> <code>
> use strict;
> use warnings;
> 
> use File::Copy;
> use File::Find::Rule;
> use File::Spec;
> 
> my $basedir = "/Users/igorsutton/workspace";
> 
> sub move_file {
> 
>     # using -M is better than doing the calculation to obtain the 
> difference
>     # from now and three days ago.
>     return unless -M $_ < 3;

Why not just use the modified( '>3' ) rule?



>     move( $_[2], File::Spec->catdir( $basedir, 'history', $_ ) )
>       or warn $!;
> 
>     # cheat with File::Find::Rule returning an undefined value, to  not
> waste
>     # memory with unused data.
>     return;
> }
> 
> # we use the name '*' to remove the current directory.
> File::Find::Rule->directory()->maxdepth(1)->name('*')->exec ( \&move_file )
>   ->in($basedir);
> </code>
> 
> Sorry for the erroneous code before.



John
-- 
Perl isn't a toolbox, but a small machine shop where you can special-order
certain sorts of tools at low cost and in short order.       -- Larry Wall

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to