Copying Files From Android Kitkat (4.4.4) to Slackware
I didn't know until I tried myself but when I connected my Samsung Galaxy Note 4 to my slacky64 (Slackware Linux) via USB, I no longer had an option to connect it as USB Mass Storage (UMS) like it did with other flash drives. In stead, it gave me two options: MTP and PTP. Hmm... what the heck are these?
Apparently, the old way of accessing the storage device had several drawbacks. One being how it was making its storage partition available to foreign systems. Whenever another system accessed the phone's storage area, it needed exclusive access to there, which means the entire storage partition was dedicated to that system and as long as that system was accessing there, the phone itself couldn't access any files or apps stored in that area. Also, this could easily mess up (or corrupt) the storage partition.
Another reason was the type of its file system. Because its storage partition needed to be available to various systems, mostly for Windows devices, it was formatted as the FAT file system (Duh...). FAT is an older and slower file system without the concept of file ownership. Not to mention Microsoft holds patents for which they demand royalties from OEM's for long file name support on the FAT file system, etc...
So what are MTP and PTP?
MTP (Media Transfer Protocol) is a subset of PTP (Picture Transfer Protocol) communication protocols that allow transferring media files from and to portable devices. These protocols have been around for a while but they are new to Android. They are considered better solutions to the problems UMS had. When a foreign system accesses the phone via MTP, it sends queries to Android and Android returns with the list of files requested. Then it downloads files. This allows access to file levels rather than exclusively opens up the entire storage portion and also allows Android choose which files to present.
This also enables Android format its storage device with ext3/ext4 or any other file systems - no longer limited to FAT!
PTP works the similar way and is mostly used by digital cameras.
For more information, please refer to Android USB Connections explained MTP, PTP, and USB Mass Storage
Now, some terminologies are out of the way, I tried transferring some photos from my Note 4 to slacky64 using MTP. Hm? It's very slow loading photos and it's even slower transferring them. Also, after photos were copied over, not only were their timestamp changed to current date and time instead of date and time taken but my photo viewer program also couldn't display them. That's not good...
I was hoping PTP would work better but no luck. It was even worse; I couldn't even get photos listed in my file manager.
Now, I went on a hunt for better ways to transfer photos.
I tried sftp and scp (with an option to retain the original timestamp) but its process kept dying on me while in the middle of transferring files.
I was kind of frustrated with this. Then, I found dukto in Google Play. It had good reviews and high rating points. I was a bit concerned about this program needing be installed on all devices, but, what the heck, as long as it'll transfer photos, I would be happy at this point.
Installation on the Android device was breeze. There were some extra steps needed to install it on my Slackware system because dukto was available in binary packages for CentOS, Fedora, OpenSUSE, RHEL, and Ubuntu and no source. This means the rpm package needs to be converted to the tgz format with the rpm2tgz command.
Converting rpm with rpm2tgz
Slackware comes with a handy utility to convert rpm files to tgz files. All you need is to run rpm2tgz with rpm file:
# cd /tmp
# rpm2tgz dukto-6.0-13.1.x86_64.rpm
...
Slackware package /tmp/dukto-6.0-13.1.x86_64.tgz created
# installpkg /tmp/dukto-6.0-13.1.x86_64.tgz
Verifying package dukto-6.0-13.1.x86_64.tgz.
Installing package dukto-6.0-13.1.x86_64.tgz:
PACKAGE DESCRIPTION:
Package dukto-6.0-13.1.x86_64.tgz installed.
#
VoilĂ ! The conversion and installation went successful. To run the program, execute dukto:
$ dukto
Transferring Files
To transfer file from the Android device to PC:
- Open dukto on both devices
- On the Android device, click on the icon you want to send your files
- Choose Send some files and folders if you are sending files
- Locate files you wish to send
- Check files
- Click on the Send icon
Once selected files have been transferred, the confirmation message is displayed.
Transferring files was snap. In my opinion, the best way to transfer files for Android devices. Although this was the best method by far, I should note that the timestamp of transferred files was still changed. At this point, it's no longer a big issue because file name contains the date taken and this info as well as the time were embedded to file itself.
There are some drawbacks of this program:
- There is no "select all" button. If you want to copy 100 files, you need to select all those files manually (or you could select a folder)
- dukto needs to be running on both devices simultaneously
- dukto must be active while transferring files; otherwise, it halts the process. This means no screensaver as well
Disclaimer:
The information in this site is the result of my researches in the Internet and of my experiences. It is solely used for my purpose and may not be suitable for others. I will NOT take any responsibility of end result after following these steps (although I will try to help if you send me your questions/problems).
That's all!
-gibb
An alternative method is to install an ftpd on android from f-droid.org and then use “wget –mirror –user abc –password def ftp://phone_ip/storage/sdcard1/dcim” from the Unix box. This preserves timestamps and fienames and mirrors everything under that directory on the android device on to the Unix/Windows box.
On a second run, the wget has a saved .listing file for every directory so doesn’t need to refetch files that have the same size and date, so it just copies new/altered files. Makes it easy to just backup all of the pictures and videos from your android device.
If you only wanted a couple of pictures then on Unix you simply copy the files you actually want to the final destination and leave the other files as a backup for the next copy since disk space is cheap or build up a command line to match the exact files you wanted.