Android 我如何 adb 拉出 SD 卡中存在的文件夹的所有文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10050925/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I adb pull ALL files of a folder present in SD Card
提问by riteshtch
I have a folder in my SD Card as:
/mnt/sdcard/Folder1/Folder2/Folder3/*.jpg
我的 SD 卡中有一个文件夹:
/mnt/sdcard/Folder1/Folder2/Folder3/*.jpg
The name of Folder1 and Folder2 remains constant and inside Folder2 I have Folder3, 4, 5 and so on.. I want to pull all the jpeg files rather than all files (there are more) using adb to my current directory on the computer..
Folder1 和 Folder2 的名称保持不变,在 Folder2 中我有 Folder3、4、5 等等。 .
Every folder has different numberof jpeg files and other files and I tried using this:
每个文件夹都有不同数量的 jpeg 文件和其他文件,我尝试使用它:
adb pull mnt/sdcard/Folder1/Folder2/Folder/*.jpg .
But it didn't work.. So uhmm how do I adb pull all files present in any folder of SD Card with a single command (single command because each folder has different number of files)
但它没有用..所以嗯,我如何使用单个命令 adb 拉出 SD 卡的任何文件夹中存在的所有文件(单个命令,因为每个文件夹都有不同数量的文件)
回答by Jared Burrows
Single File/Folder using pull
:
单个文件/文件夹使用pull
:
adb pull "/sdcard/Folder1"
Output:
输出:
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.
Specific Files/Folders using find
from BusyBox
:
使用find
from 的特定文件/文件夹BusyBox
:
adb shell find "/sdcard/Folder1" -iname "*.jpg" | tr -d '5' | while read line; do adb pull "$line"; done;
Here is an explanation:
这是一个解释:
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 '5' - 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. The quotation marks around $line are required to work with filenames containing spaces.
The scripts will start in the top folder and recursively go down and find all the "*.jpg" files and pull them from your phone to the current directory.
脚本将从顶部文件夹开始,然后递归查找所有“*.jpg”文件并将它们从手机拉到当前目录。
回答by Palani
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 )
目录拉取可在新的 android 工具上使用。(我不知道它是从哪个版本添加的,但它适用于最新的 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)
回答by Ilavarasan
Please try with just giving the path from where you want to pull the files I just got the files from sdcard like
请尝试只提供您想要提取文件的路径,我刚刚从 sdcard 中获取文件,例如
adb pull sdcard/
adb pull sdcard/
do NOT give * like to broaden the search or to filter out. ex: adb pull sdcard/*.txt --> this is invalid.
不要给 * like 扩大搜索范围或过滤掉。例如:adb pull sdcard/*.txt --> 这是无效的。
just give adb pull sdcard/
只需给 adb pull sdcard/
回答by Posting as a guesty-guest
Yep, just use the trailing slash to recursively pull the directory. Works for me with Nexus 5 and current version of adb (March 2014).
是的,只需使用尾部斜杠递归拉目录。适用于 Nexus 5 和当前版本的 adb(2014 年 3 月)。
回答by antimatter
On Android 6 with ADB version 1.0.32, you have to put / behind the folder you want to copy. E.g adb pull "/sdcard/".
在带有 ADB 版本 1.0.32 的 Android 6 上,您必须将 / 放在要复制的文件夹后面。例如adb pull "/sdcard/".
回答by naXa
If you want to pull a directory with restricted access from a rooted device you need to restart adb as root: type adb root
before pull. Otherwise you'll get an error saying remote object '/data/data/xxx.example.app' does not exist
如果你想从一个有 root 权限的设备拉取一个限制访问的目录,你需要以 root 身份重新启动 adb:adb root
在拉取之前输入。否则你会得到一个错误说remote object '/data/data/xxx.example.app' does not exist
回答by EDward
if your using jellybean just start cmd, type adb devices to make sure your readable, type adb pull sdcard/ sdcard_(the date or extra) <---this file needs to be made in adb directory beforehand. PROFIT!
如果您使用 jellybean 刚启动 cmd,请输入 adb devices 以确保您的可读性,输入 adb pull sdcard/sdcard_(date or extra) <---此文件需要事先在 adb 目录中制作。利润!
In other versions type adb pull mnt/sdcard/ sdcard_(the date or extra)
在其他版本中输入 adb pull mnt/sdcard/sdcard_(日期或额外)
Remember to make file or your either gonna have a mess or it wont work.
记住要制作文件,否则你要么会一团糟,要么就行不通。