in reply to File Creation Dates
As merlyn notes, you can't get a files' creation date on Unix (and possibly other platforms), but often using a file's last modification date instead will work in many cases.
If that's an acceptable alternative, then you can do something like...
use POSIX qw/ strftime /; sub mdate { my($file,$format) = @_; # Unless otherwise specified, use # MM/DD/YYYY as date format. $format ||= '%m/%d/%Y'; my $date = ( stat($file) )[9]; return strftime( $format => localtime $date ); } my $dir = '/path/to/files'; my $date = '04/11/2002'; chdir $dir or die "Cannot chdir($dir): $!\n"; opendir DIR, '.' or die "Cannot opendir($dir): $!\n"; foreach my $file ( readdir DIR ) { print $file, "\n" if mdate($file) eq $date; }
--k.
|
|---|