Ubuntu – How to rsync to android

androidrsync

How can I connect to my android device to rsync music (or other stuff)?

Best Answer

Actually using rsync over MTP/usb

It's easier than everyone is saying, first notice that when GVFS mounts the MTP mount it'll be available under. You can force this by opening the phone up in a graphical file-browser (thunar/nautilus/etc)

/run/user/$UID/gvfs

go in there. Assuming you have one mtp device, this should work:

$ cd /run/user/$UID/gvfs/mtp*

Find where you want to transfer the files too, and then rsync them to it

$ cd SanDisk\ SD\ card/Movies/

$ pwd # prints "/run/user/1000/gvfs/mtp:host=%5Busb%3A003%2C096%5D/SanDisk SD card/Movies"

$ rsync --verbose --progress --omit-dir-times --no-perms --recursive --inplace ~/Videos/ ./

Rsync options

  • --inplace: I highly suggest using --inplace without which mtp may want to copy the file a new, and then rename it to the old one. That may result in copying the file to the SD card twice: once for the mtp transfer to the SD card, and another time because the MTP driver may not support (mv), it may (cp/rm) under the hood to be safe.
  • read man rsync for a description of --verbose, --progress, --recursive but they're pretty self-documenting.
  • --omit-dir-times --no-perms are required because mtp doesn't support that.
Related Question