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 https://play.google.com/store/apps/details?id=org.galexander.sshd

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.