aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2023-07-18 19:49:58 -0300
committerSilvio Rhatto <rhatto@riseup.net>2023-07-18 19:49:58 -0300
commitd87724345ff0227de597f00fd75a8dade0fe1eb3 (patch)
treefe94b7f5d3ebf34d426644fff329c4a64600b3a9
parent7da6ddaaf62a0fb54d1eac542c08258da54d3c15 (diff)
downloadscripts-d87724345ff0227de597f00fd75a8dade0fe1eb3.tar.gz
scripts-d87724345ff0227de597f00fd75a8dade0fe1eb3.tar.bz2
Feat: android-backup: sync sd cards
-rwxr-xr-xandroid-backup18
1 files changed, 12 insertions, 6 deletions
diff --git a/android-backup b/android-backup
index d270ec6..1985f6b 100755
--- a/android-backup
+++ b/android-backup
@@ -15,24 +15,30 @@ function android_backup_files {
USER_ID="0"
fi
- BASE="/storage/emulated/$USER_ID"
+ BASE="/storage"
+ EMULATED="$BASE/emulated/$USER_ID"
# Files: full copy
- #adb pull $BASE files/
+ #adb pull $EMULATED files/
# Remove multimedia cache from backup
#rm -rf files/Music
# Files: full basic copy
- #adb shell ls -1 $BASE | grep -v ^Music | while read file; do
- # adb pull $BASE/$file files/
+ #adb shell ls -1 $EMULATED | grep -v ^Music | while read file; do
+ # adb pull $EMULATED/$file files/
#done
mkdir -p files/$USER_ID
# Files: incremental basic copy
- for file in `adb shell ls -1 $BASE | grep -v '^Music'`; do
- adb-sync --delete --reverse $BASE/$file files/$USER_ID/
+ for file in `adb shell ls -1 $EMULATED | grep -v '^Music'`; do
+ adb-sync --delete --reverse $EMULATED/$file files/$USER_ID/
+ done
+
+ # SD cards
+ for file in `adb shell ls -1 $BASE | grep -v "^self" | grep -v "^emulated"`; do
+ adb-sync --delete --reverse $BASE/$file files/
done
}