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;

    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.

--
Igor Sutton
[EMAIL PROTECTED]



Attachment: PGP.sig
Description: This is a digitally signed message part

Reply via email to