At 8:18 AM -0700 11/15/06, Ashley M. Kirchner wrote:
I have files that are named in the following manner:
file.####.jpg (where #### is an hhmm timestamp [hour and minutes])
What's the best way to take the current hhmm timestamp and run
backwards finding the previous 5 files, and checking whether they
actually exist? There's a possibility one or more might not exist
and rather than returning a blank value, I want to continue further
back till I find the next.
So for example, say I have:
file 1122.jpg
file 1121.jpg
file 1119.jpg
file 1117.jpg
file 1116.jpg
file 1114.jpg
My suggestion is to read all the files in the directory into an
array, sort the array, and pull out the top five. That way it makes
no difference if there are any gaps and you also check to see if the
files do exist.
Also, at some point, you'll need to delete, and that's not a bad way
to delete the older files either.
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php