Skip to content

Instantly share code, notes, and snippets.

@himalay
Last active March 30, 2019 01:43
Show Gist options
  • Save himalay/9829177dae51185f639a82f7a88a1377 to your computer and use it in GitHub Desktop.
Save himalay/9829177dae51185f639a82f7a88a1377 to your computer and use it in GitHub Desktop.
# Start the sryncd using /sdcard/rsyncd.conf in android device
adb shell -t -t 'sh /sdcard/rsync-start'
# Bind the port to 1988
adb forward tcp:1988 tcp:1992
# Create backup folder
mkdir ~/sdcard
# Start syncing /sdcard
rsync -av --update --progress --stats \
--exclude 'Android/' \
--exclude '.thumbnails/' \
--exclude '.cache/' \
--exclude 'sleep-data/' \
--exclude 'rsyncd/' \
rsync://localhost:1988/root/sdcard/ ~/sdcard/
# Stop port forwarding
adb forward --remove tcp:1988
# Or, remove all port forwardings
adb forward --remove-all
# Content of rsync-start
rsync --daemon --no-detach --config=/sdcard/rsyncd.conf --log-file=/sdcard/rsyncd/rsyncd.log
# Content of rsyncd.conf
address = 127.0.0.1
port = 1992
[root]
path = /
use chroot = false
read only = false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment