in reply to How to read list of files based on date ?

You can get the names of every file in a directory with the readdir command
opendir (DIR,"./"); @files = readdir DIR;
And the stat command gives you access to the details of a file
foreach $file (@files){ if ( -f $file){ my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime, +$blksize,$blocks)= stat($file); push (@wanted) $file if ((time() - $mtime) < (24*60*60); } }

Replies are listed 'Best First'.
Re^2: How to read list of files based on date ?
by doug (Pilgrim) on May 22, 2009 at 14:27 UTC
    Instead of stat() and calculating the age in days yourself, that is returned by the -M operator.
    my @wanted = grep -f $_ && -M _ < 1, @files;
    or something close to that.