How can i use rsync to transfer files from my android devices

Hi there
I have been struggling with this for quite some time now… I want to sync the photos on my phone to my computer using rsync, but cannot figure out what is wrong. I have given the following commands in my terminal:

sudo rsync -rv --omit-dir-times --no-perms --inplace “/run/user/1000/gvfs/mtp:host=SAMSUNG_SAMSUNG_Android_258c9b8234057ece/Phone/DCIM/test/” /home/brandon/Pictures/test

and this is the ouput of the terminal:

sending incremental file list
rsync: [sender] change_dir “/run/user/1000/gvfs/mtp:host=SAMSUNG_SAMSUNG_Android_258c9b8234057ece/Phone/DCIM/test” failed: Permission denied (13)

sent 19 bytes received 12 bytes 62.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1330) [sender=v3.2.3]

please if anyone can help that would be greatly appreciated

That can only be achieved by running an rsync service on your phone.

It will be much simpler to use cp -ur

  -R, -r, --recursive          copy directories recursively


  -u, --update                 copy only when the SOURCE file is newer
                                 than the destination file or when the
                                 destination file is missing

I found it easier to set up an SSH server on Android and bypass all the MTP issues.

I use this SimpleSSHD which is also on the Play Store

Follow the guide to install the keys and change the port to 2222. After that SSH is as easy as any other computer.

1 Like

Thank you, this is so simple. I did not realise that the cp command had those options.

I will definitely try this out, sounds like a really cool idea.

Hi there i tried running the following command as you recommended :
sudo cp -upr /run/user/1000/gvfs/mtp:host=SAMSUNG_SAMSUNG_Android_258c9b8234057ece/Phone/DCIM/test /home/brandon/Pictures/

and got:

cp: cannot stat ‘/run/user/1000/gvfs/mtp:host=SAMSUNG_SAMSUNG_Android_258c9b8234057ece/Phone/DCIM/test’: Permission denied

any ideas what i could be doing wrong?

Honestly… It would be so much easier to just use syncthing, which is what I use.

You can also use rsync in termux on Android if you really want

It’s also in F-Droid as well!

F-Droid is repository for FOSS apps for those who don’t know. Sometimes the apps on F-Droid are a bit different from the Play Store version, such as the removal of all Firebase or Google trackers in the F-Droid versions.