Blog Archive

Thursday 10 December 2015

CLI Android ADB rsync on a MAC (or Linux)


$ export PATH=~/Downloads/android-sdk-macosx/platform-tools:$PATH

$ mv rsync.rsync4android rsync.bin

$ adb push rsync.bin /data/local/tmp/rsync
3922 KB/s (793148 bytes in 0.197s)

$ adb shell chmod 755 /data/local/tmp/rsync

$ adb shell cp /data/local/tmp/rsync /sdcard/rsync.bin

$ adb shell /data/local/tmp/rsync --version
rsync  version 3.1.1  protocol version 31
Copyright (C) 1996-2014 by Andrew Tridgell, Wayne Davison, and others.
Web site: http://rsync.samba.org/
Capabilities:
    64-bit files, 64-bit inums, 32-bit timestamps, 64-bit long ints,
    no socketpairs, hardlinks, symlinks, no IPv6, batchfiles, inplace,
    append, no ACLs, no xattrs, no iconv, no symtimes, no prealloc

rsync comes with ABSOLUTELY NO WARRANTY.  This is free software, and you
are welcome to redistribute it under certain conditions.  See the GNU
General Public Licence for details.

$ adb shell 'exec >/sdcard/rsyncd.conf && echo address = 127.0.0.1 && echo port = 1873 && echo "[root]" && echo path = / && echo use chroot = false && echo read only = false'

$ adb shell /data/local/tmp/rsync --daemon --no-detach --config=/sdcard/rsyncd.conf --log-file=/proc/self/fd/2
2015/10/28 20:59:16 [11983] rsyncd version 3.1.1 starting, listening on port 1873


In a new terminal window:

$ export PATH=~/Downloads/android-sdk-macosx/platform-tools:$PATH

$ cd Downloads/nexus5/sdcard/

$ adb shell '/data/local/tmp/rsync --daemon --config=/sdcard/rsyncd.conf --log-file=/data/local/tmp/foo &'

$ adb forward tcp:6010 tcp:1873

$ rsync -av --progress --stats rsync://localhost:6010/root/sdcard/ .

receiving file list ...