From b4b0f6151756291c5ecc4fe8269b9b68c43aee3c Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Fri, 5 Oct 2012 14:57:47 +0200 Subject: [PATCH] use find instead of ls, create backup dir if needed This changes make it work in empty checkout and fix usage of ls -1 which doesn't seem to work with recent Cyanogenmod busybox, see #1 --- adb-pull-clockworkmod-backup.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/adb-pull-clockworkmod-backup.sh b/adb-pull-clockworkmod-backup.sh index ae5008c..d201ff3 100755 --- a/adb-pull-clockworkmod-backup.sh +++ b/adb-pull-clockworkmod-backup.sh @@ -2,7 +2,8 @@ sdcard=/sdcard/clockworkmod/ -adb shell ls -1 -d $sdcard/backup/* | sed "s!$sdcard/*!!" | tr -d '\r' > /tmp/backup.android -ls -1 -d backup/* > /tmp/backup.disk +adb shell find $sdcard/backup/ -mindepth 1 -maxdepth 1 | sed "s!$sdcard/*!!" | tr -d '\r' > /tmp/backup.android +test -d backup || mkdir backup +find backup/ -mindepth 1 -maxdepth 1 -type d | sed 's!backup/!!' > /tmp/backup.disk diff -uw /tmp/backup.android /tmp/backup.disk | grep -- '^-backup' | sed 's/^-//' | \ xargs -i sh -xc "mkdir {} && adb pull $sdcard/{} {}" -- 2.20.1