Android - How can I transfer photos to my Android Jelly Bean device while preserving the original timestamp?

You can't, this is a current permission problem (bugreport here) of Android 4.0+'s /sdcard folder if it's not using FAT32 (but FUSE).

Reason: There's a transition away from FAT32 to unified user storage for both apps and media data (using ext4) on a single file system.

We got tired of seeing OEMs include many GB of internal storage for music, while users were still running out of space for apps and data. This approach lets us merge everything on one volume, which is way better.

-- Dan Morrill, Android engineer at Google

The old FAT32 properties are emulated using a FUSE layer to be compatible with existing apps. Also: /data/ and /sdcard on Google devices starting with the Nexus 7 use a single partition only (/data/media represents the "sdcard" content and is exposed using the FUSE layer to apps).

Here's CyanogenMod's implementation of the FUSE driver if you're interested in seeing the source. Looks like setting timestamp attributes is implemented, though.

EDIT: It only works with root.

Exact reason: All files are owned by root.sdcard_rw (see here).

A caller withouth uid=0 can't call the utimensat() syscall, it fails in the VFS layer already (EPERM) for timestamps other than current:

  1. the caller's effective user ID must match the owner of the file; or
  2. the caller must have appropriate privileges.

To make any change other than setting both timestamps to the current
time (i.e., times is not NULL, and both tv_nsec fields are not
UTIME_NOW and both tv_nsec fields are not UTIME_OMIT), either condition
2 or 3 above must apply.


I recently came across this issue on a Nexus 5 and tried most the solutions listed here with no luck. In my case, it looks to be caused by a recognized bug with stock Android (source).

My solution was as follows - I used Windows 8.1, but no reason this wouldn't work on OSX/Linux (root is required on device however).

  1. On your PC, create a .tar.gz archive of all the files you wish to transfer.

    • I used 7zip for this - It's worth mentioning on Windows, you'll need to create the .tar archive first, then apply the .gz compression.
  2. Transfer the archive to the device using FTP, ensuring the MFMT command is used.

    • FTP Server supports MFMT on the device side. Just install and enable, no extra configuration needed.
    • On the PC, I used Filezilla - you do need to ensure Transfer > Preserve timestamps of transferred files is checked.
  3. On the device, extract the archive in a shell as root.

    • Using Terminal Emulator, first ensure you have root access by using the su command. You may need to grant access if SuperSU pops up.
    • Navigate to the directory now containing the .tar.gz archive with the cd command e.g: cd /sdcard/
    • Extract the archive using the following: tar -xvf ARCHIVE_NAME_HERE.tar.gz
    • Note: For some reason, when I extracted directly to the DCIM/Camera directory, the pictures would not show up at all in the stock gallery app. If this happens to you, I suggest you extract to a different directory and then move (not copy) the files to your camera directory. I suspect this is caused by a permissions issue. You can use the terminal or your file manager of choice to move the files.
  4. Reboot for good measure.

This allowed all the files 'date modified' attributes to remain intact, and left all photos in the correct order when viewed in the gallery app.


Check the EXIF data and see if there's a timestamp there.

If there is, Photo Date Correction will allow you to overwrite the botched file timestamp with the EXIF one, giving you back your proper sorting.