one solution could probably be made using: glob(), sort() and/or filemtime().

btw: I assume your aware that the filenames are not very unique (i.e. twice a
day, everyday a given file will potentially be overwritten) and that this
is intentional

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
> 
>    Notice the gaps, 1120, 1118, and 1115 are missing.  But I still want
> to return five, thus 1122, 1121, 1119, 1117, and 1116.
> 
>    I thought of taking the current timestamp and loop five times,
> subtracting from it every time, but that's assuming all five are there. 
> If one's missing then I only have four images.
> 
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to