Skip to content

Instantly share code, notes, and snippets.

@maluta
Created September 3, 2014 12:27
Show Gist options
  • Save maluta/9ebcc2fd87865c7c0246 to your computer and use it in GitHub Desktop.
Save maluta/9ebcc2fd87865c7c0246 to your computer and use it in GitHub Desktop.
import subprocess
import sys
import os
arg = sys.argv[1]
cmd = ("adb shell ls \"" + arg + "\"")
# creating dir
folder = arg.split("/")[::-1][1]
print("Creating dir: ./" + folder)
os.mkdir(folder)
# listing files
print(cmd)
files_list = subprocess.getstatusoutput(cmd)
# pull
for f in files_list[1].split('\n'):
download_cmd = "adb pull \"" + arg + f + "\" ./\"" + folder +"\""
r = subprocess.getstatusoutput(download_cmd)
print(download_cmd)
if r[0] == 1:
print(">> erro")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment