Paul Harwood wrote: > > I want to search a directory of log files and populate a list of those > log files ONLY if they match today's date (localtime). > > $logs = 'c:\logs\W3SVC1'; > opendir LOGS, "$logs" or die "Can't open directory: $!\n"; > my @files = grep /\.TXT$/, readdir LOGS; > > #Right here, I am wondering if there is a simple way of populating @files > by using a date comparison operation of each file to the local time. I've > tried long complicated methods of using 'stat' and Time::Local but I was > hoping for a simpler solution.
Ah, a simple solution. :-) ( my $date = localtime ) =~ s'\d+:\d+:\d+'\d+:\d+:\d+'; my @files = grep localtime( (stat)[9] ) =~ $date, <c:/logs/W3SVC1/*.TXT>; print "@files\n"; John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]