Skip to content

Instantly share code, notes, and snippets.

@thomas479
Last active December 29, 2024 19:03
Show Gist options
  • Save thomas479/7ea65242983b2ad6e75fe0d69b0e2763 to your computer and use it in GitHub Desktop.
Save thomas479/7ea65242983b2ad6e75fe0d69b0e2763 to your computer and use it in GitHub Desktop.
Android adb pull all files as tar
adb exec-out 'tar --dereference --create --exclude=sdcard/Android/data/com.spotify.music/ \
sdcard/ 2>/sdcard/backup-errors.txt' | \
dd of=backup-$(date +%Y%m%d).tar && \
adb shell cat /sdcard/backup-errors.txt
@jmfernandez
Copy link

I'm curious if it's possible to restore the tarball using exec-in. 🤔

Unless there are file permission issues, why not? Something like this should be possible (disclaimer, the command has not been tested):

dd if=backup-file.tar | \
adb exec-in 'tar xpvf -  2>/sdcard/restore-errors.txt' && \
adb shell cat /sdcard/restore-errors.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment