By Mahn

2012-12-17 13:43:22 8 Comments

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.)


@Raúl Salinas-Monteagudo 2019-05-18 10:46:29

To copy files from your Android to your PC keeping timestamps:

adb shell tar c -C /storage/emulated/0/XXX . | tar xv

To restore them back to the Android:

tar c . | adb shell tar xv -C  /storage/emulated/0/XXX 

This works by creating a tar file within the device, that is immediately extracted on your host, and viceversa.

The "v" lets you see the name of the file being copied.

Of course this assumes that you have "adb" installed, that the phone has USB debugging enabled, and that you already validated the debugging certificate.

sudo apt install adb

@Oren 2017-02-02 23:09:56

I will add my solution that worked on Ubuntu

First install simple-mtpfs and install fuse

cd ~
mkdir myphone
simple-mtpfs ~/myphone

Now you have your phone folders mounted on this directory, you can use rsync -t , or cp -p to copy the pictures and the created/modified/accessed times will not be changed.

Work for me :)

@Teresa e Junior 2018-05-01 11:14:58

In the terminal, while mounted with simple-mtpfs, timestamps appear as preserved. But when accessing the files in the phone, the timestamps seem to be all reset.

@Daniele Segato 2015-09-03 16:26:28

If you use the Google Photo app and you want your file to be listed in the right order there's a solution.

The background of the issue

This is an Android Bug. It does not allow non-root user to change the modification date of files ( since the introduction of multi-user / sandbox with FUSE filesystem). And does not preserve the timestamp when copying files with MTP protocol (

The workaround for Google Photo users

Photos are ordered using the EXIF information if available, so you can just use any manners of setting the right EXIF data to them. Any camera should set this automatically for you, just make sure the date/time is correct in them.

For videos or if you do not want to set the EXIF data just go to and upload your video / photos from there. It preserve the modification timestamp you have on your computer and since it is synced with your device you'll see the photo in the app, correctly sorted, as soon as you are done with the upload.

@Tropique 2015-08-13 02:30:03

Use PTP instead of MTP when connecting your phone by USB. It works for me, I use a Samsung Note 4 connected to Ubuntu 14.04 machine. However, connecting as PTP only allows copying of pictures/images. All other methods od copying files (bluetooth, WIFI, file manager) into an external drive will change the date.

@mgutt 2016-05-30 16:47:51

I tested that with Windows 10 and a Note 3 using CM 12.1 (Android 5.1.1). I moved the files (the only way windows allows preserving) but it did not preserve the timestamps. :(

@Pao 2013-08-24 14:49:05

I have a Nexus 4 and had the same issue with time-stamp and photos (indeed all the files).

Here are the command lines (with a rooted phone) I used, thanks to a 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" which contains the folder "savandroid"

adb root
adb push savandroid /sdcard

All files and folder that are in "saveandroid" are sent to SD card worked nicely with all time-stamps correct!

Note: On Cyanogenmod I had to select root for "apps and adb" in developers menu. By default it's only set on apps.

@Richard Cannon 2015-06-12 20:57:38

Use SyncMe Wireless and network share. The timestamps are preserved and the sync is quick. I was able to back up without a computer to SD Card in Kingston MobileLite Wireless in 20 minutes, re-sync instant.

@Matthew Read 2015-06-14 15:55:23

Can you link this app?

@Andrew T. 2015-06-26 01:20:12

I could only find the link for SyncMe Wireless, but not "Network share", unless you actually meant it is a single app. Also provide the short summary of the app and the steps to do it if possible.

@Antonio 2015-06-23 21:25:50

I moved to a Moto X 2014 and I had this problem.

I tried many things as well, a solution seemed to be "Motorola Migrate" to synchronize with WiFi two phones (an old gingerbread backflip). In the gallery, the situation was good (even in details), but strangely in file manager the date was changed, and after few hours even the gallery also shown the transfer date.

The workaround, if the files are not too many, could be manually copy one by one, changing each time the date and hour on the phone.

@Guest 2015-04-18 21:48:45

Try app "Bluetooth File Transfer" it preserves the modified date with move. And I believe with copy too but try with one file/ folder first to make sure. It can also explore the other device via bluebooth.

@eldarerathis 2015-04-19 23:52:53

Providing a link to apps that you recommend would make this a more useful answer.

@Wyzard 2015-03-21 17:53:59

As mentioned in another answer, on devices that use FUSE for SD card emulation (such as modern Nexus devices), only root can change timestamps of files in /sdcard. Since things like MTP and ADB don't run as root, you can't preserve the timestamps with these methods. However, if your device is rooted, you can fix the timestamps with a separate step afterward.

While restoring a full backup of /sdcard from a Linux PC to my tablet, I used this command to fix all the timestamps after uploading the files with adb push:

find . | while read file; do timestamp_stat=$(stat -c "%y" "$file"); timestamp=$(date +"%Y%m%d.%H%M%S" -d "$timestamp_stat"); echo "$timestamp: $file"; adb shell su -c "touch -t $timestamp \"/sdcard/$file\""; done

This should be run from the root of the directory on the PC that corresponds to /sdcard on the device. (Or, if you uploaded something other than a full /sdcard backup, change the path in the touch command near the end. But you should run this from whatever directory on the PC corresponds to the directory in the touch command.)

The way it works is that it goes through all the files on the PC side, gets the timestamp of each, and runs a touch command as root on the device to set the timestamp of the corresponding file there.

Note that this will run a separate su command for each individual file. If you have logging enabled in your root program (e.g. SuperSU), you may want to disable that to avoid producing large numbers of log entries. And if you have your device configured to prompt for confirmation on every su request, you'll probably want to change that temporarily. (It may be possible to come up with a variation that pipes a stream of touch commands into a single root shell on the device, but the straightforward way of doing that didn't work when I tried it, and I didn't want to spend much time on it.)

I've used this with success on a Nexus 10 running Android 5.1.

@PJ_Finnegan 2015-03-16 17:28:15

Quick and easy solution: simply use a PC or Mac to copy the files from the old SD Card (or PC) to the new SD Card. Use a PC/Mac with an SD Card reader/writer (there are USB-to-SD Card converters) which sees the card as a FAT32 USB storage. When you're done copying, re-insert the new card in your phone and reboot.

@rmorrin 2014-11-03 14:42:01

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.

@mgutt 2016-05-30 16:28:51

They show not up in the gallery because of the media index. It does not recognize your terminal operation but if you use a file manager app it reports the new moved files to the index and now they are found again. Are you sure that the ftp part is really needed? I wonder because the ftp can not change the files that are inside the tar, so why should this be important?

@rmorrin 2016-06-03 09:20:48

@mgutt I guess you're right about the FTP part not being required. I was piecing together pieces of information from other suggestion solutions and this was what ended up working for me!

@Stackguest50 2014-04-27 09:45:09

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.

@AntonK 2014-06-23 16:37:33

copying files to external SD-cards doesn't cause the problem with the modification timestamp

@Cédric 2014-04-12 17:54:51

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!

@Marhensa 2013-10-16 00:57:11


  • 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.

@AntonK 2014-06-23 16:28:46

Droid Explorer requires ROOT, doesn't it?

@mgutt 2016-05-30 20:41:53

@AntonK Yes Droid Explorer needs Root to preserve the timestamp. If Root is not available it will overwrite the date:…

@Tomy 2013-04-03 15:23:31

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.

@ce4 2012-12-21 15:06:50

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.

@Mahn 2012-12-22 01:15:57

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 2013-02-20 12:24:47

Update for future readers: this remains unfixed in 4.2.2.

@Mahn 2015-12-10 17:11:02

Update for even more future readers: unfixed in 6.0 marshmallow.

@Turtle 2012-12-21 00:34:22

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.

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

/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.

@Turtle 2012-12-21 00:53:36

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".

@Mahn 2012-12-22 01:02:30

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: (perhaps I should make a separate question, since this is not directly related with the timestamps themselves. Gotta love mtp though)

@Izzy 2012-12-17 14:54:32

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.

@Mahn 2012-12-18 19:08:23

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.

@Izzy 2012-12-18 19:36:09

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).

@Mahn 2012-12-18 20:51:05

I'll check it, but considering SSHDroid didn't work for me I guess I won't get the timestamps with it either.

@Izzy 2012-12-18 21:12:29

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...

@Mahn 2012-12-20 09:33:43

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.

@Izzy 2012-12-20 09:38:53

Gosh. Then it must have to do with changes due to Android 4.x/MTP. Sorry for that, I have no 4.x device to check -- but it still was worth a try.

@Mahn 2012-12-20 13:44:53

Np, I appreciate the help. I guess I'll have to give up for now, already wasted too much time on this.

@Izzy 2012-12-20 14:03:06

Yepp. That's one of the reasons I'd never buy a device without a removable storage (here: Android device w/o sdcard slot). If the device becomes unresponding, you cannot even take your data to another. For me an absolute no-go.

@mgutt 2016-05-30 16:51:01

FolderSync preserves the timestamp only for uploaded files and only if you use FTP or SMB: If you download them f.e. to a new phone the timestamp is lost. Because of that I'm having a complete backup of all my media files on my nas with correct timestamps, but I'm not able to move them to the new phone without loosing that :(

@Izzy 2016-05-30 16:57:02

In the worst case, one can always restore timestamps for photos from their Exif data. Tools for that exist for most platforms. But granted, I wasn't aware that FolderSync keeps them one-way only as I rarely sync from PC to Android (usually just the other way around). My photos are kept on the external SD card, so I can simply replace that ;)

@Compro01 2012-12-17 14:30:59

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.

@Mahn 2012-12-18 19:04:48

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.

Related Questions

Sponsored Content

1 Answered Questions

Stream data via mtp

1 Answered Questions

Mount Galaxy A5 (2017) on Ubuntu via MTP

4 Answered Questions

[SOLVED] Is there a viable alternative to MTP for file transfer?

  • 2014-12-16 21:59:39
  • fostandy
  • 41209 View
  • 38 Score
  • 4 Answer
  • Tags:   file-transfer mtp

6 Answered Questions

[SOLVED] Best way to transfer photos from Android 4.4.4 to Windows 7

2 Answered Questions

[SOLVED] How to use "USB Mass Storage Mode" on Android 4.3+

1 Answered Questions

[SOLVED] MTP oddities on Windows 10

Sponsored Content