in reply to Efficient multiplatform directory polling
sub getNewestFile { my $dir=shift; my @files=glob "$dir/*"; my %mtimes; map { $mtimes{$_}=(stat $_)[9] } @files; @files=sort { $mtimes{$b}<=>$mtimes{$a} } keys %mtimes; $files[0]; }
See what you think, burden on your system should be minimal if you do it less than once every second.
HTH,
SSF
|
|---|