|XP is just a number|
Finding oldest file in directoryby Nitrox (Chaplain)
|on Oct 18, 2004 at 18:11 UTC||Need Help??|
Nitrox has asked for the wisdom of the Perl Monks concerning the following question:
I have a script that needs to determine the oldest file in a particular directory and I'm concerned about the efficiency of my current solution. (This runs every 60 seconds, which is why I'm concerned with optimization). Here's an example snippet:
This script runs across multiple platforms (Win32, Solaris, Linux and AIX) so limits me from some perhaps "easier" solutions.
Another important piece of info is that the directory is relatively small and has no more than 10 files at any given time, so I wasn't concered about the numerous stat calls.
So is my current solution acceptable, and I'm trying to micro-optimize, or does anyone see a glaring performance issue?
Thanks in advance for feedback!