-
-
Save thomas479/7ea65242983b2ad6e75fe0d69b0e2763 to your computer and use it in GitHub Desktop.
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 |
I'm curious if it's possible to restore the tarball using
exec-in
. 🤔So? Is it? Also, (forgive me for being a noob) but why is there a "2" after Sdcard? This is to pull the contents of the entire internal memory of a phone, correct?
All the Linux / Android processes have at least three file handles. 0 is for standard input, 1 for standard output and 2 for standard error. In shell scripts, when used, '<' is used to send a file to the standard input of the program, '>' is used to save the standard output to a file, and '2>' is used to save the standard error to a file.
The command line after adb exec-out
which is within the single quotes is run within the phone. As the tar
command emits by default the tar archive through its standard output, you don't want to garble it with the warning and error messages emitted by the same tar
command.
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
So? Is it? Also, (forgive me for being a noob) but why is there a "2" after Sdcard?
This is to pull the contents of the entire internal memory of a phone, correct?