Here's yet another WTDI:
This solution maintains a queue/array of size N (ie. store the names of the newest 5 files)
Linearly traverse the directory structure Compare timestamp of current file to timestamp of oldest/last item i +n queue If file is newer Seek (the sorted) insertion point in the queue, and insert via spl +ice If queue size > N pop off the oldest element from the queue Repeat until finished...
When finished, you'll have a sorted array containing the newest 5 files
Update: BTW, you'll need to save the appropriate stat info for each queue element
In reply to Re: How can I access a cross directory set of data files by most recently modified date?
by thezip
in thread How can I access a cross directory set of data files by most recently modified date?
by SkipHuffman
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |