3 # find files that were last modified 'yesterday'
7 my $debug = shift if $ARGV[0] eq '-x';
8 my $dir = shift or die "yesterday: [-x] <directory> [<days>]";
10 opendir D, $dir or die "cannot open directory '$dir' $!";
11 my @fn = map {[(stat("$dir/$_"))[9], "$dir/$_"]} readdir D;
16 my $low = (int($t / 86400) - $days) * 86400;
17 my $high = (int($t / 86400) - ($days - 1)) * 86400;
18 my $clow = gmtime $low;
19 my $chigh = gmtime $high;
20 print "lowest: $clow highest: $chigh\n" if $debug;
21 for (sort {$a->[0] <=> $b->[0]} @fn) {
24 my $cmtime = gmtime $_->[0];
26 printf "%-30s LOW $cmtime < $clow\n", $_->[1];
27 } elsif ($_->[0] >= $high) {
28 printf "%-30s HIGH $cmtime >= $chigh\n", $_->[1];
30 printf "%-30s OK $cmtime\n", $_->[1];
32 } elsif ($_->[0] >= $low && $_->[0] < $high) {
34 } elsif ($_->[0] >= $high) {