Trasferring files between Android and PC preserving modification time
This is going to be a short post1.
So, I've been using my old phone in a daily basis during 6 years, until this last month, where I switched to another phone. The old phone still works perfectly, but I was worried about it stopping working someday. Not only that, but performance and battery life issues were getting noticeable.
I had some image folders in the old phone, and I wanted to send them to my new phone. My first approach was the following:
- Connect the old phone to my PC.
- Transfer the files from the phone to the PC through Dolphin (the KDE file manager).
- Disconnect the old phone and connect the new one.
- Transfer the files from the PC to the new phone, again with Dolphin.
When I opened my phone gallery, the files where there, yay! But I noticed something, and is that the files were all unordered! All of this process overwrote the last modification date of all the files I transferred. So this didn't work for me, because I rely on this metadata.
So, searching a bit in the internet, I found a way that preserves this metadata using the adb command! So I did a second approach:
- Connect the old phone to my PC.
- Transfer the folders I want to the PC through the command
adb pull -a /storage/emulated/0/<folder> ~/<folder>. - Disconnect the old phone and connect the new one.
- Transfer the folders from the PC to the new phone, through the command
adb push ~/<folder> /storage/emulated/0/<folder>.
So easy! This time I could see the images on my gallery in an ordered way. This can be very useful for other people so I wanted to share it here :)
In my experience, writing posts for a blog was always extremely time and energy consuming. I always try to make long posts with a lot of content and explanations. So, many things I can end up sharing, are not shared because of the tremendous effort I didn't want to do to write in that moment. But it doesn't have to be like that. A short post is always better than no post. Also, as a blog reader, I tend to digest and prefer short posts than long ones. So write short posts for me to read, and make me happy :P↩