in reply to To count number of files created yesterday in a directory
#!/usr/bin/perl use strict; use warnings; use Time::Piece; use Time::Seconds; my $t = localtime() - ONE_DAY; # yesterday my $count = grep {$t->ymd eq localtime( (stat)[9] )->ymd} glob "*.*";
my $count = grep {$t == localtime( (stat)[9] )} glob "*.*";
Update: Of course it wouldn't work as it's comparing 'ymdhms' rather than 'ymd'.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: To count number of files created yesterday in a directory
by hippo (Archbishop) on Feb 04, 2017 at 11:18 UTC | |
by haukex (Archbishop) on Feb 04, 2017 at 13:13 UTC |