Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re^7: ignore list of files using readdir function

by poj (Parson)
on Jul 23, 2013 at 12:37 UTC ( #1045847=note: print w/replies, xml ) Need Help??

in reply to Re^6: ignore list of files using readdir function
in thread ignore list of files using readdir function

In that case a simpler more direct approach might work for you
#!perl use strict; my $inpath = "/AAA/BBB/CCC/IN"; my $outpath = "/AAA/BBB/CCC/OUT"; # check inpath files less than 60 mins # and more than 15 mins old my $min_age = 0.25/24; # 15 mins in days my $max_age = 1.00/24; # 1 hour in days my $count =0; my $ignore=0; print "Scanning in dir $inpath .. \n"; opendir DIR, $inpath or die $!; for (readdir DIR){ # skip if not a file next unless (-f "$inpath/$_"); # filter on age my $age = -M "$inpath/$_"; if ( ($age > $min_age) && ($age < $max_age) && ( !/_ACK_/ ) ){ # build outfile name (my $outfile = $_) =~ s/(\.xml)$/_ACK$1/; # check outfile exists if (-e "$outpath/$outfile"){ print "$_ => $outfile exists\n"; } else { print "$_ => $outfile does not exist\n"; } ++$count; } else { ++$ignore; } } closedir DIR; print "$count files checked - $ignore files ignored\n";

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1045847]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2016-12-10 19:29 GMT
Find Nodes?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:

    Results (164 votes). Check out past polls.