John007 has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use Data::Dumper; use Time::localtime; $year = (localtime -> year) + (1900); $mon = (localtime -> mon) + (1); $mday = localtime -> mday; $hour = localtime -> hour; $min = (localtime -> min) ; opendir (DIR, $directory) or die $!; while (my $file = readdir(DIR)) { if ($file =~ /^\w{10,16}(.txt)$/i ) { $filename = $1; if (($year == $fyear) && ($mon == $fmon) && ($mday == $fmday) && ($ho +ur == $fhour) && ($min == ($fmin + 1))) { $myfile = $filename; } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Finding Last minute file in a directory
by zwon (Abbot) on Aug 16, 2009 at 16:23 UTC | |
|
Re: Finding Last minute file in a directory
by CountZero (Bishop) on Aug 16, 2009 at 16:17 UTC | |
|
Re: Finding Last minute file in a directory
by ssandv (Hermit) on Aug 16, 2009 at 16:20 UTC | |
|
Re: Finding Last minute file in a directory
by graff (Chancellor) on Aug 16, 2009 at 22:36 UTC | |
|
Re: Finding Last minute file in a directory
by John007 (Acolyte) on Aug 16, 2009 at 16:40 UTC | |
by John007 (Acolyte) on Aug 16, 2009 at 16:52 UTC | |
by zwon (Abbot) on Aug 16, 2009 at 17:59 UTC |