Android Gallery app – Pictures order

A few weeks ago I bought a new Android phone, the Samsung Galaxy S2 to be precise. On my old cell I took a lot of pictures and I wanted to transfer them to the new phone. In order to do so, I backed up the camera folder /mnt/sdcard/DCIM/Camera to my computer and afterwards I copied it to the new phone. So far so good.

However, as soon as I looked at the pictures in the Gallery app it occurred to me that they were not chronologically ordered anymore. I found out that the Gallery app is sorting the pictures by the time stamps of the files. During the copy process all the timestamps of the photos have been lost.

The pictures are named as IMG_YYYYMMDD_HHmmSS.jpg and the videos are stored as VID_YYYYMMDD_HHmmSS.m4v. To solve the problem I have written a shell script which is “touching” the files depending on the file names to correct the time stamps.

You can download the full script here. You need busybox installed to use this script. To install busybox you need to root your phone. Also you can not execute a script from the sdcard, so you have to copy it to an folder where you have executive rights, as /data/local/tmp/.

After executing the script you may have to reboot the phone. Afterwards your Gallery app should show the pictures in the correct order!

1 thought on “Android Gallery app – Pictures order

Leave a Reply to jason Cancel reply

Your email address will not be published. Required fields are marked *