From 9a42a6c53c83467476cdee919f9abdb936161dcd Mon Sep 17 00:00:00 2001 From: HappyZ Date: Wed, 15 May 2019 13:29:23 -0500 Subject: [PATCH] Update pull_data_from_phone.sh --- pull_data_from_phone.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/pull_data_from_phone.sh b/pull_data_from_phone.sh index 265657d..1cc01df 100755 --- a/pull_data_from_phone.sh +++ b/pull_data_from_phone.sh @@ -5,12 +5,22 @@ LOCALFOLDER=$2 mkdir -p $LOCALFOLDER +if [[ ! $? -eq 0 ]]; then + echo "Cannot create folder $LOCALFOLDER" + exit $?; +fi + + for file in $(adb shell "ls $PHONEPATH" | tr -d '\r'); do if [[ $PHONEPATH = *"*" ]]; then adb pull "${PHONEPATH%%/*}/$file" $LOCALFOLDER/ - adb shell rm "${PHONEPATH%%/*}/$file" + if [[ $? -eq 0 ]]; then + adb shell rm "${PHONEPATH%%/*}/$file" + fi else adb pull "$PHONEPATH/$file" $LOCALFOLDER/ - adb shell rm "$PHONEPATH/$file" + if [[ $? -eq 0 ]]; then + adb shell rm "$PHONEPATH/$file" + fi fi done