aatlamaz has asked for the wisdom of the Perl Monks concerning the following question:
my $dir = "C:\\Perl"; opendir DH, $dir or die "Cant open $dir: $!"; foreach $file (readdir DH) { print "files in $dir id $file\n"; } closedir DH; my $oldest; my $oldtime = 0; for (glob "$dir/*") { my $thistime = -C; if ($thistime > $oldtime) { ($oldest, $oldtime) = ($_, $thistime); } } printf "The oldest file was %s, and it was %.1f days old.\n", $oldest, + $oldtime;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Finding Newest File in Perl
by zentara (Cardinal) on Dec 07, 2004 at 13:35 UTC | |
by aatlamaz (Novice) on Dec 07, 2004 at 14:39 UTC | |
|
Re: Finding Newest File in Perl
by neniro (Priest) on Dec 07, 2004 at 10:53 UTC |