MTP is crap for that task – OK for a few files in "small folders", but stalling for folders with many files in, or copying many files, or trying things in parallel.
As you use Linux, ADB would be a great alternative. I use that with adbfs-rootless, which allows mounting the device locally on your computer and works like a charm (I'm using it for years, so I can confirm it works at least up to Oreo).
First, to get ADB running, you can check with How do I get my device detected by ADB on Linux?. ADB binaries are shipped in the repositories of many distributions by a name like android-tools-adb
so you can easily install them; alternatively take a look at Is there a minimal installation of ADB? for an even smaller footprint.
Installation of adbfs
is quite straight-forward if you have the essential build tools already installed on your system: according to the readme, next to build-essential
you'll need libfuse-dev
and pkg-config
available on your system. The git
package is only needed if you want to clone the Github repository (alternatively, you can simply download the code as ZIP). cd
to the directory you've cloned/unpacked the code to, and run make
. When that's done, copy the adbfs
binary to your path (e.g. into /usr/local/bin
or ~/bin
if you've set that up), so you don't need to specify the full path with each call – and you are ready to use it.
Finally, create a mount-point (an empty directory where your device's file system shall appear, say mnt
in your home directory), and mount it with adbfs ~/mnt
– et voila, your copy party can begin; from the terminal or graphically is up to you. When done, use fusermount -u ~/mnt
to unmount your device again.
As a little bonus for you: should you sometimes have multiple devices attached at the same time, you'll need to set the ANDROID_SERIAL
environment variable to tell adbfs
which device to connect to. Here's a little script making that easier for you:
case "$(adb devices|grep -v "devices"|grep -v -e '^[[:space:]]*$'|wc -l)" in
0) echo "Nothing to mount (no device attached)" ;;
1) export ANDROID_SERIAL=$(adb devices|grep -v "devices"|grep -v -e '^[[:space:]]*$'|awk '{
print $1'
}
)
adbfs /mnt/droid
;;
*) devices=''
tmpfile=$(tempfile)
adb devices -l|grep -v "devices"|grep -v -e '^[[:space:]]*$' > $tmpfile
while IFS='\n' read i
do
test="$(echo $i | awk '{
print $2
}
')"
if [ "$test" = "device" ]; then
devices="$devices $(echo $i | awk '{
print $1
}
')"
devices="$devices \"$(echo $i | awk '{
print $5
}
')\""
fi
done < "$tmpfile"
rm -f -- "$tmpfile"
serial=$(whiptail --clear --menu 'Multiple devices found, make your choice:' 0 0 0 $devices 3>&1 1>&2 2>&3)
export ANDROID_SERIAL=$serial
adbfs /mnt/droid
esac
If you wonder about the indention: it's a snippet out of my Midnight-Commander (mc
) menu. You can insert it there, preceding it by
= t d
+f ^mnt$
m
Mount Droid
So whenever your mount point is highlighted by the cursor, pressing F2 will make that menu item available and you can easily mount your device. For unmounting, here's the second menu item:
+f ^mnt$
u
uMount Droid
fusermount -u /mnt/droid
^mnt$
is the name of the mount-point you've created – so if you used a different name, you need to adjust this as well.
Enjoy!