Created
May 30, 2011 15:17
-
-
Save aldafu/999043 to your computer and use it in GitHub Desktop.
Copy utility shell script for use with Android debug bridge (adb). Supports wildcards when copying from remote source to local destination directory. Example: adb-cp.sh /sdcard/DCIM/Camera/*.jpg ~/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function usage() | |
{ | |
echo "USAGE: adb-cp.sh <remote> <local dir>" | |
exit 1 | |
} | |
if [ $# -ne 2 ]; then | |
usage | |
fi | |
if ! [ -e $2 ]; then | |
mkdir -p $2 | |
else | |
if ! [ -d $2 ]; then | |
echo "error: destion must be a directory" | |
usage | |
fi | |
fi | |
LIST=$(adb shell ls "${1}") | |
SAVEDIFS=${IFS} | |
IFS=$(echo -e "\n\r") | |
for i in ${LIST}; do | |
if [ -z $i ]; then | |
continue | |
fi | |
adb pull $i "$2" | |
done | |
IFS=${SAVEDIFS} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment