Advertisement

Delving into the iPhone's DCIM folder

Today, Dave Caolo discovered what happens when your iPhone camera rolls past picture number 99999 (or so). As he and other Apple users have found, a picture count that goes too high can lead to unforseen errors. Human sacrifice. Dogs and cats living together. Mass hysteria. Or a camera roll that doesn't acknowledge new photos.

Snapped images are stored on your iPhone in your home folder. As user "mobile," that home folder is /var/mobile and the folder that stores your iTunes library, your voice memos, and your photos is /var/mobile/Media. Inside that media folder is a subfolder named DCIM.

Read on for more details.



Standing for digital camera images, the DCIM folder follows the Japan Electronics and Information Technology Industries Association (JEITA) naming specification for digital still cameras.

Inside /var/mobile/Media/DCIM, you typically find an image subfolders. ###APPLE (starting with 100APPLE, and going up from there) folders store pictures snapped by the iPhone camera (IMG_0001.JPG, IMG_0002.JPG, etc). Until the 3.0 firmware, the 999APPLE folder has stored shots of the iPhone screen. With 3.0 and later, those shots appear to be directed into the other APPLE folders and saved with PNG extensions. Thumbnails and other helper files appear in a sub-sub-folder called .MISC.

TUAW Tip: Press and hold the Sleep/Wake button and tap the Home key to take screenshots. The screen flashes white to let you know that the shot has been added to your DCIM folder.

There is another subfolder in the top DCIM folder called .MISC. Inside that folder, the iPhone camera application stores a couple of preview images and a property list. (See the screen shot at the top of this post.) This property list contains a counter for the last file shot. So, with the following Info.plist contents, the next photo to be snapped and stored into the 100APPLE folder will be IMG_0736.JPG.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>LastFileGroupNumber-100</key>
<integer>736</integer>
</dict>
</plist>

Each time you pass 1000 photos, a new entry is added to this property list and a new subfolder created in DCIM. After 999 groups, and I'm looking at you Dave, you run into trouble.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>LastFileGroupNumber-100</key>
<integer>999</integer>
<key>LastFileGroupNumber-101</key>
<integer>1</integer>
</dict>
</plist>

So how can you solve Dave's dilemma? Although you can use Ecamm's PhoneView to copy that Info.plist file out from the .MISC folder and edit it directly. that's probably more effort and risk than you might want to deal with. Dave's posted solution seems to do the job pretty well. And after testing other methods this morning, I'm going to endorse his solution. Editing property list files is a pretty big hammer for what can be fixed with a tiny nail.

So why did I follow up? If this post is meant to do anything, it simply explains what is going on behind the scenes. It shows you what is going on in the DCIM folder and why that folder can run into problems when your snapped photo count gets too high.

This is clearly a problem that's begging for an Apple-side firmware fix. Hopefully they'll address the problem in the next firmware update. If you have developer credentials (they are free for online membership), you can file a radar at bugreport.apple.com. Duplicate bug reports count as "votes." The more votes a bug report gets, the more likely Apple is to fix that bug. They just need to fix the rollover code to accommodate people taking thousands of pictures.