Update pull_data_from_phone.sh

This commit is contained in:
HappyZ 2019-05-15 13:29:23 -05:00
parent c350262b72
commit 9a42a6c53c
1 changed files with 12 additions and 2 deletions

View File

@ -5,12 +5,22 @@ LOCALFOLDER=$2
mkdir -p $LOCALFOLDER 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 for file in $(adb shell "ls $PHONEPATH" | tr -d '\r'); do
if [[ $PHONEPATH = *"*" ]]; then if [[ $PHONEPATH = *"*" ]]; then
adb pull "${PHONEPATH%%/*}/$file" $LOCALFOLDER/ adb pull "${PHONEPATH%%/*}/$file" $LOCALFOLDER/
adb shell rm "${PHONEPATH%%/*}/$file" if [[ $? -eq 0 ]]; then
adb shell rm "${PHONEPATH%%/*}/$file"
fi
else else
adb pull "$PHONEPATH/$file" $LOCALFOLDER/ adb pull "$PHONEPATH/$file" $LOCALFOLDER/
adb shell rm "$PHONEPATH/$file" if [[ $? -eq 0 ]]; then
adb shell rm "$PHONEPATH/$file"
fi
fi fi
done done