import subprocess
import os
from tqdm import tqdm
adb_path = "K:/adb/adb/adb.exe"#adb地址
local_path = "K:/photo"#放入电脑的本机地址
def folder_adb(folder_path):
# 构建 ADB 命令
adb_command = [adb_path, "shell", "ls", folder_path]
# 执行 ADB 命令并获取输出
result = subprocess.run(adb_command, capture_output=True, text=True)
output = result.stdout
files = output.strip().split('\n')
num = 0
for i in files:
num+=1
pbar = tqdm(range(0,num))
for i in files:
pbar.update()#进度条更新
pull_command = f"{adb_path} pull {folder_path}/{i} {local_path}"
os.system(pull_command)
delect_command = f"{adb_path} shell rm {folder_path}/{i}"#删除语句,如果不需要可以注释
os.system(delect_command)
folder_adb("/storage/emulated/0/Pictures/Screenshots")#手机截图地址
import subprocess
import os
from tqdm import tqdm
adb_path = "K:/adb/adb/adb.exe"#adb地址
local_path = "K:/photo"#放入电脑的本机地址
def folder_adb(folder_path):
# 构建 ADB 命令
adb_command = [adb_path, "shell", "ls", folder_path]
# 执行 ADB 命令并获取输出
result = subprocess.run(adb_command, capture_output=True, text=True)
output = result.stdout
files = output.strip().split('\n')
num = 0
for i in files:
num+=1
pbar = tqdm(range(0,num))
for i in files:
pbar.update()#进度条更新
pull_command = f"{adb_path} pull {folder_path}/{i} {local_path}"
os.system(pull_command)
delect_command = f"{adb_path} shell rm {folder_path}/{i}"#删除语句,如果不需要可以注释
os.system(delect_command)
folder_adb("/storage/emulated/0/Pictures/Screenshots")#手机截图地址