Deecee wrote:
> 
> I am trying to search a particular directory and all of it's subdirectories
> for files that are newer that 1/1/00 and delete them.  It seems like it
> should be rather simple but I am racking my brain to try and put it
> together.
> 
> I have a hunch that the answer lies in the 'stat' command and using
> File::Find then unlinking the file that matches the date.  But like I said I
> am having trouble making it all come together.


This should get you started (untested):

#!/usr/bin/perl -w
use strict;
use File::Find;
use Time::Local;

my $dir = '/some/dir/to/search';
my $date = timelocal( 0, 0, 0, 1, 0, 100 ); # Jan. 1 2000

find( sub {
    if ( -f and (stat _)[9] >= $date ) {
        unlink $_ or warn "Cannot delete $File::Find::name: $!";
        }
    }, $dir );

__END__


John
-- 
use Perl;
program
fulfillment

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

Reply via email to