Efficiently selecting a range of digital photos by timestamp

1

I am copying a number of images from a slow network share that exposes a digital camera's DCF file system. I don't want all the images, just those that fall within a specific time interval.

Calling stat on each file to get its timestamp takes too long, so I'm trying to be more efficient about it.

The DCF filesystem splits every 1,000 photos into a separate directory. One idea is to sort the files in a given directory by the filename number, e.g., DSC00590.JPG, DSC00591.JPG, DSC00592.JPG, and then check the timestamps of the first and last files to see if the whole directory falls outside my interval or not.

However this might fail if a photo is deleted, and a new photo is subsequently taken, should the new photo get the number of the deleted one. That would break the assumption that the timestamps and filenames are both monotonically increasing.

So the question is: Is it safe to assume monotonically increasing file numbering? Is there some other trick I could use to efficiently subset the photos according to timestamp?

rgov

Posted 2019-11-04T00:11:56.057

Reputation: 171

Answers

-1

The DCF specification recommends assigning the number one greater than the maximum number in a given directory. However, it is not required.

Additionally, it recommends warning the user before deleting a directory, because it might create a discontinuity.

What is left unspecified is, if you have two directories (say, 100 and 101), and 100 is full, and you delete the last photo in 100, and then take a new photo, where does it go?

Thus the behavior may differ from camera to camera and hence it is not a safe assumption that numbering is monotonically increasing. At best I should test this particular system to determine its behavior, but the behavior cannot be assumed for arbitrary DCF filesystems.

I did not find a better way than to stat all the files.

rgov

Posted 2019-11-04T00:11:56.057

Reputation: 171

This does not answer the question should've been posted as a comment – Máté Juhász – 2019-11-04T05:31:20.593