On Jan 17, 2008 4:18 PM, oryann9 <[EMAIL PROTECTED]> wrote:

> I am not a liar! I am a Christian and the only little help I have received is:

If you don't see that the help you're being given is neither "only"
nor "little", you're not paying attention.

> P.S. Apologizes for not knowing I was supposed to disclose to this list
> I use perlmonks, gesz.

Not knowing is not your sin; your sin is not paying attention:

    http://www.nntp.perl.org/group/perl.beginners/2008/01/msg97973.html

I feel inexplicably obliged to give you something new, but so much has
already been said, both here and on PerlMonks. So I'm appending a
program to this message that shows an unusual way of setting the prune
variable. You can, I hope, improve upon this algorithm once you
understand it.

Good luck with it!

--Tom Phoenix
Stonehenge Perl Training

    #!/usr/bin/perl

    use strict;
    use warnings;
    use File::Find;

    my $max_size = 1000;
    my $start_search = time - 24 * 60 * 60;
    my $start_time_string = localtime $start_search;
    my @keepers;

    sub wanted {
        my($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
           $atime,$mtime,$ctime,$blksize,$blocks) = lstat($_);
        if (-d _) {
            # Consider for pruning
            print "Current directory: $File::Find::name\n";
            print "Would you like to search within it? (y) ";
            if (<STDIN> =~ /n/i) {
                $File::Find::prune = 1;
            }
        };
        push @keepers, $File::Find::name
            if $size < $max_size and $mtime > $start_search;
    }

    find(\&wanted, '/');

    print "These are the files under $max_size bytes which have\n";
    print "been modified since $start_time_string, except for any\n";
    print "files in the skipped directories.\n";
    print "  $_\n" for @keepers;

__END__

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


Reply via email to