in reply to efficient way to find most recently modified files?
If you're concerned about stuffed directories producing huge in-memory lists or arrays, opendir will give you a handle you can read one name at a time. Since you are looking for maximum times, you can keep memory requirements low and independent of population.
Your requirement for a creation time is tougher because it's not a portable statistic. Unix filesystems don't have any such thing. Think about that requirement, though. Is the intent to advertise newest content? Then an edited file ought to be as good as a newly uploaded one. In that case, mtime is what you want, and it is quite portable.
System touch and Perl utime can alter file times, and touch can create empty files. Filesystem time stamps should not be regarded as definitive of anything.
You should take a look at File::Find. It's not the easiest thing to use, but it can handle any problem of this kind.
Update: ++davido's solution is best if you know that all uploads come in through your script. With shell or ftp access in the mix, you'd need to do a lot of maintainance in cron jobs.
After Compline,
Zaxo
|
|---|