Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

I recently bought a Nexus 4 and I would like to transfer my photos of my previous device to it. My previous Android phone used the standard USB mass storage which gave 0 problems to copy back and forth stuff, but the Nexus 4, like many other modern Android phones I suppose, uses MTP instead, which has the interesting feature of refusing to copy the original dates/timestamps of the files, using instead the date at which the files are being copied.

This is obviously a huge bummer when it comes to photos; not only because one cannot check the original date at which the picture was taken while browsing on the phone, but also because they end up completely unsorted.

Is there a way to transfer photos to a Jelly Bean Android phone that doesn't support USB mass storage preserving the original timestamps?

Things I've tried so far:

  • Transferring via USB MTP
  • ADB push (both full folders and individual files)
  • Transferring via SSH (using SSHDroid + WinSCP)
  • Uploading and downloading from Dropbox
  • Transferring a ZIP file via MTP and uncompress the file on the phone
  • Transferring from the other phone via bluetooth
  • QuickPic "fix date" function
  • Local Sync
  • Photo Date Correction
  • FTPSyncX
  • Smoke signals
  • Yelling at the phone

None of them preserved the timestamp, and this is driving me insane.

(Also, I am not rooted yet, but if the only viable way requires root I would welcome that answer as well.)

share|improve this question
    
Does Android support untaring .tar files? If so, maybe you could copy a .tar file of the pictures. I don't know if the untaring would change the timestamp of the individual files or not. –  Chance Dec 21 '12 at 22:46
    
@Chance tried that before but didn't help either; the issue is nothing has privileges to write the timestamp by default, so there's nothing one can do but rooting right now. –  Mahn Dec 22 '12 at 1:19
    
Also, to everyone who chimed in in this question: Thanks. The way SE sites work I can only accept one answer, but every answer here helped in some or other way. –  Mahn Dec 22 '12 at 1:21

10 Answers 10

up vote 8 down vote accepted

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.

share|improve this answer
    
Thanks for the info, let's hope this is something google can and would be willing to address, because as far as I can tell the problem is not the fuse layer or the mtp protocol, but the strict privileges that were set there, which by the way appear to be pretty recent (4.2.1?) since the Photo Date Correction app posted below did seem to work with older, 4.0 fuse/mtp based devices such as the galaxy nexus. –  Mahn Dec 22 '12 at 1:15
1  
Update for future readers: this remains unfixed in 4.2.2. –  Mahn Feb 20 '13 at 12:24

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.

share|improve this answer

Backup solution using "SanDisk Memory Zone" to preserve timestamp date. copy/moving files from Android device to external SDCard - Tested on Samsung Note 2, Note 3 and Mini SIII

Just backup your photo files to SDCard and move the card to other Android, PC, Apple or other device - if not used to backup your photo files, follow this simple 8 steeps instructions"

  1. Search on Google Play and install "SanDisk Memory Zone".
  2. Start the App and wait for index file to finish.
  3. Select Backup/Restore and change or mark settings.
  4. Select Memory Card destination and what to backup (contacts, sms, photos, music, etc).
  5. Verify required and available capacity, and go on CONTINUE botton.
  6. Wait for the backup to complet.
  7. Now you have a copy of the files in your SDCard on ".memoryzone_backup/files/1"
  8. Now you can move your SD Card files like photos to your Windows, Linux or other Android device preserving original Timestamp.
share|improve this answer
    
copying files to external SD-cards doesn't cause the problem with the modification timestamp –  AntonK Jun 23 at 16:37

My solution to preserve modification date during file copy on Android device with MTP:

Tested on LG G2 stock (without root), Andorid 4.4.2 and HTC one M7, Andorid 4.4.2:

  1. Network share of the folder to copy on the computer (Win 8)
  2. Use SyncMe Wireless to copy files from computer to device

As far as I can see, the modification dates are fully preserved!

share|improve this answer

PRESERVING DATE MODIFIED ON NEXUS DEVICE --- NO ROOT NEEDED ---

  • From Android to PC: Use MTP
  • From PC to Android: Use Droid Explorer

cheers.. :)

it preserve Date Modified. I dont know how Droid Explorer does it. but it just works.

make sure USB Debuging checked before use Droid Explorer.

um.. there's one limitation though.. Droid Explorer only can transfer files, not folders.

  • with Droid Explorer, copy files into android phone on some specific folder
  • then with file manager inside android, move those files into folder we want, do not use copy because copy will alter date modified while cut doesn't.
share|improve this answer
    
Droid Explorer requires ROOT, doesn't it? –  AntonK Jun 23 at 16:28

I have nexus 4 and had the same issue with timestamp and photos (indeed all the files).

Here are the command lines (with a rooted phone) i used thanks to this post (on ubuntu):

sudo apt-get install android-tools-adb

(on ubuntu if android sdk is not installed)

adb devices cd /media/my_backup_folder_where_i_put_a_folder_with_all_my_data_named_"savandroid"_in_it

In order to go in my folder "backup" witch contain the folder "savandroid"

adb root adb push savandroid /sdcard

all files and folder that are in "saveandroid" are sent to sdcard

worked nicely with all timestamp correct !

tips : on cyamogenmod I had to select root for "apps and adb" in developers menue by default it's only set on apps

share|improve this answer

This is a question which really trouble me a lot when come across with devices which only have MTP but not the Mass storage mode. I also have concerns about it with exactly the same reasons with Mahn.

After some testing, I have find a temp solution which maybe able to preserve the timestamp.

It makes use of the excternal sdcard / OTG card reader and also the cp command with -a the timestamp will be able to preserve. But the requirement is the phone need to be rooted.

  1. First copy the data to SDcard.
  2. Read it with memory card slot / OTG card reader
  3. use adb shell and acquire root permission (su)
  4. cp -a * the data from card to internal memory.
share|improve this answer

I have the exact same issue. It seems that it's being blocked by fuse on the Nexus 4 running Stock JellyBean 4.2.1.

SYMLINKS:
/sdcard -> /storage/emulated/legacy
/storage/emulated/legacy -> /mnt/shell/emulated/0

MOUNT POINT:
/mnt/shell /dev/fuse /mnt/shell/emulated fuse \
    rw,nosuid,nodev,relatime,user_id=****,group_id=****,default_permissions,allow_other 0 0

That info was taken via an adb shell session; I presume that fuse will be in the mix for all app-level accounts.

TL;DR From the looks of it, it can't be done without rooting the phone.

share|improve this answer
1  
My "solution" for the time being is to upload pictures from past phones one at a time in chronological order, with pauses in-between, in a different directory. Here's the Linux shell script I'm using: [old_pictures]$ for f in $(ls -1 * | sort -t _ -k 2); do adb push $f /storage/sdcard0/DCIM/Past/; sleep 3; done; If you go this route, do a test upload first to be sure you're satisfied. Also, disable Google+ Instant Upload while you're at it so you don't get "double uploads". –  Turtle Dec 21 '12 at 0:53
    
Thanks, that helps; as your for script: both mtp via windows and adb push drop the connection for me after the first thousand files or so in my case, plus some files randomly end up corrupted, are you seeing the same? basically as this issue describes here: code.google.com/p/android/issues/detail?id=35185 (perhaps I should make a separate question, since this is not directly related with the timestamps themselves. Gotta love mtp though) –  Mahn Dec 22 '12 at 1:02

Use a synchronization tool like e.g. FolderSync, which should take care for timestamps accordingly. Synchronization tools should be specialized in handling all aspects of really maintaining synchronous copies -- including time stamps, of course.

share|improve this answer
    
I tried a couple of sync tools, but none synced the timestamp, because I guess there is some sort of protection. Thanks for the answer though. –  Mahn Dec 18 '12 at 19:08
    
Did you try FTPSyncX Trial? Not the most sophisticated look maybe (the dev is no designer). But I use the Pro for about a year already, and it syncs timestamps fine via SFTP/SSH (the only protocol I use -- the app can handle more). –  Izzy Dec 18 '12 at 19:36
    
I'll check it, but considering SSHDroid didn't work for me I guess I won't get the timestamps with it either. –  Mahn Dec 18 '12 at 20:51
    
I almost bet it will. I still remember how hard that part was for the dev -- we sat hours on Skype discussing the issue :) There was that ugly time problem on Windows, which sometimes reported things wrongly... Oh, getting OT :) Simply try it, cannot hurt, right? And let us know how it worked out... –  Izzy Dec 18 '12 at 21:12
    
Nothing. FTPSyncX Trial as a client on the phone, freeSSHd as a server on my laptop, I'm able to connect and sync files via STP/SSH, but the timestamp of pictures transferred to the phone is still getting overwritten to the current date. –  Mahn Dec 20 '12 at 9:33

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.

share|improve this answer
    
Nothing. The EXIF data is there, and the app reported to successfully have changed the timestamps when I used it, but they stayed the same; I rebooted and deleted the cache of the gallery aswell, but that didn't help. Does the app require root? It seems as if there were some sort of write protection on the timestamps that nothing is able to overcome. –  Mahn Dec 18 '12 at 19:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.