我如何adb拉存在SD卡中的文件夹的所有文件

我的SD卡中有一个文件夹:/mnt/sdcard/Folder1/Folder2/Folder3/*.jpg

Folder1和Folder2的名称保持不变,在Folder2里我有Folder3,4,5等..我想拉所有的JPEG文件,而不是所有文件(有更多)使用ADB到我的当前目录在计算机上。

每个文件夹有不同数量的jpeg文件和其他文件,我试着用这个:

adb pull mnt/sdcard/Folder1/Folder2/Folder/*.jpg . 

但它没有工作..所以呃,我怎么adb拉存在SD卡的任何文件夹中的所有文件与一个命令(单一命令,因为每个文件夹有不同数量的文件)

单个文件/文件夹使用pull

 adb pull "/sdcard/Folder1" 

输出:

 adb pull "/sdcard/Folder1" pull: building file list... pull: /sdcard/Folder1/image1.jpg -> ./image1.jpg pull: /sdcard/Folder1/image2.jpg -> ./image2.jpg pull: /sdcard/Folder1/image3.jpg -> ./image3.jpg 3 files pulled. 0 files skipped. 

BusyBox使用find特定文件/文件夹:

 adb shell find "/sdcard/Folder1" -iname "*.jpg" | tr -d '\015' | while read line; do adb pull $line; done; 

这里是一个解释:

 adb shell find "/sdcard/Folder1" - use the find command, use the top folder -iname "*.jpg" - filter the output to only *.jpg files | - passes data(output) from one command to another tr -d '\015' - explained here: http://stackoverflow.com/questions/9664086/bash-is-removing-commands-in-while while read line; - while loop to read input of previous commands do adb pull $line; done; - pull the files into the current running directory, finish 

脚本将从顶层文件夹开始recursion下去,find所有“* .jpg”文件,并将它们从手机中拉到当前目录。

目录拉是可用的新的Android工具。 (我不知道它是从哪个版本join的,但是它使用最新的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) 

请尝试只是从你想要拉的文件我刚刚从SD卡的文件的path

adb拉SD卡/

不要给*喜欢扩大search或过滤。 例如:adb pull sdcard / *。txt – >这个是无效的。

只要给adb拉sdcard /

是的,只需使用尾部的斜杠来recursion地拉出目录。 适用于Nexus 5和当前版本的adb(2014年3月)。

在具有ADB版本1.0.32的Android 6上,您必须将/放在要复制的文件夹后面。 例如adb pull "/sdcard/".

如果您使用jellybean只是启动cmd,请键入adb devices以确保您的可读,typesadb拉sdcard / sdcard_(date或额外)<—此文件需要预先在adb目录中进行。 利润!

在其他版本中键入adb pull mnt / sdcard / sdcard_(date或额外)

记得做文件或者你要么有一个烂摊子,否则不会工作。

如果你想从一个有根的设备拉出一个具有受限访问权限的目录,你需要以root权限重新启动adb:在pull之前键入adb root 。 否则,你会得到一个错误,说remote object '/data/data/xxx.example.app' does not exist