Re: Checking file existence

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Edward Kay wrote:
Are all the files called file.xxxx.jpg or could they have other names such
as clouds.1123.jpg, field.2034.jpg etc?
They are all the same exact file name with the only difference being the timestamp.

Alternatively, you could get the OS to do the work through an exec call to
something like 'ls *.????.jpg' or similar. The downside of this however is
that it is then OS dependent.
I thought of that too, but only because of the way the files are stored. I completely forgot about one other catch... I thought about it but my hands were too quick and I didn't type that paragraph in.

   The files are stored as follows on the file system:

/.year/month/day/hour/file.hhmm.jpg (yes that dot preceding year is correct)

   So I can look right now and find /.2006/11/15/08/file.0846.jpg

Each /hour/ folder contains at most 60 files so in essence doing either a scandir() or an exec call to ls wouldn't take that long. However, I run into problems when I need to traverse to the previous hour to find images.

Say I load up a file with timestamp 0802. I now need to find 0801, 0800, 0759, 0758, and 0757. The last three being in the previous folder. Unless I run scandir() again the entire /day/ folder and sort, I'd have to figure out how to go on about that.

Like I said, I completely forgot to write this piece of the puzzle in my previous e-mail. I blame it on the lack of caffeine.

   -- A

--
W | It's not a bug - it's an undocumented feature.
 +--------------------------------------------------------------------
 Ashley M. Kirchner <mailto:ashley@xxxxxxxxxx>   .   303.442.6410 x130
 IT Director / SysAdmin / Websmith             .     800.441.3873 x130
 Photo Craft Imaging                       .     3550 Arapahoe Ave. #6
 http://www.pcraft.com ..... .  .    .       Boulder, CO 80303, U.S.A.

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux