adb pull multiple files

2019-01-16 05:07发布

What is the best way to pull multiple files using

adb pull

I have on my /sdcard/ 25 files with following name:

gps1.trace
gps2.trace
...
gps25.trace

Wildcard does not work:

adb pull /sdcard/gps*.trace .

标签: android adb
11条回答
劫难
2楼-- · 2019-01-16 05:11

Wild cards work in my case, I have been using following simple script to import Whatsapp Images of my virtual device in to my desktop

#! /bin/bash
mkdir -p ~/Pictures/Pictures_adb
rm -f ~/Pictures/Pictures_adb/*
cd ~/Pictures/Pictures_adb
adb root
adb shell 'cp /data/media/0/WhatsApp/Media/WhatsApp\ Profile\ Photos/* /sdcard/Pictures/;exit'
adb pull /sdcard/Pictures
mv ~/Pictures/Pictures_adb/Pictures/* ~/Pictures/Pictures_adb/
rmdir ~/Pictures/Pictures_adb/Pictures
cd
查看更多
我命由我不由天
3楼-- · 2019-01-16 05:15

I have created this for Windows boxes, It is very useful to transfer files using wildcards without mounting the filesystem. You can include this script somewhere in your path env.

adbpull.bat

@echo off
setlocal enabledelayedexpansion
if %1.==. (
    echo Wilcard parameter is required.
    goto end
)
for /F "tokens=* USEBACKQ" %%F in (`adb shell ls %1`) do (
    set text=%%F
    set mfile=!text:~0,-1!
    adb pull "!mfile!"
)
:end
endlocal

Example: adbpull /sdcard/DCIM/Camera/IMG_2016*

查看更多
相关推荐>>
4楼-- · 2019-01-16 05:16

In Android, there are some folder with associated permissions! Some folder belong to root- or system user.

You guys should change the permissions of those files, folders before doing "adb pull".

The following commands could help:

adb shell
su
chmod -R 777 target_folder
exit
...
adb pull /.../target_folder/ . (current local folder)
查看更多
老娘就宠你
5楼-- · 2019-01-16 05:18

./adb pull /sdcard <-- fails

./adb pull /sdcard/ <-- works recursively - note the trailing slash

Tested with Nexus 5 and adb downloaded March 2014.

查看更多
\"骚年 ilove
6楼-- · 2019-01-16 05:20

Directory pull is available on new android tools. ( I don't know from which version it was added, but its working on latest ADT 21.1 )

adb pull /sdcard/Robotium-Screenshots
pull: building file list...
pull: /sdcard/Robotium-Screenshots/090313-110415.jpg -> ./090313-110415.jpg
pull: /sdcard/Robotium-Screenshots/090313-110412.jpg -> ./090313-110412.jpg
pull: /sdcard/Robotium-Screenshots/090313-110408.jpg -> ./090313-110408.jpg
pull: /sdcard/Robotium-Screenshots/090313-110406.jpg -> ./090313-110406.jpg
pull: /sdcard/Robotium-Screenshots/090313-110404.jpg -> ./090313-110404.jpg
5 files pulled. 0 files skipped.
61 KB/s (338736 bytes in 5.409s)
查看更多
时光不老,我们不散
7楼-- · 2019-01-16 05:27

Parsing the output from 'ls' is generally a bad idea. Instead, use 'find'.

adb shell 'find /sdcard/ -name "gps*.trace" -print0' | xargs -0 -n 1 adb pull

Why you shouldn't parse the output of ls

查看更多
登录 后发表回答