我如何 adb 拉取 SD 卡中存在的文件夹的所有文件 [英] How do I adb pull ALL files of a folder present in SD Card
问题描述
我的 SD 卡中有一个文件夹:/mnt/sdcard/Folder1/Folder2/Folder3/*.jpg
I have a folder in my SD Card as:
/mnt/sdcard/Folder1/Folder2/Folder3/*.jpg
Folder1 和 Folder2 的名称保持不变,在 Folder2 里面我有 Folder3、4、5 等等.我想使用 adb 将所有 jpeg 文件而不是所有文件(还有更多)拉到我在计算机上的当前目录中..
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..
每个文件夹都有不同数量的 jpeg 文件和其他文件,我尝试使用这个:
Every folder has different number of jpeg files and other files and I tried using this:
adb pull mnt/sdcard/Folder1/Folder2/Folder/*.jpg .
但是没用..那么,嗯,我如何使用单个命令 adb 拉取 SD 卡任何文件夹中存在的所有文件(单个命令,因为每个文件夹都有不同数量的文件)
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)
推荐答案
使用 pull
的单个文件/文件夹:
Single File/Folder using 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
的特定文件/文件夹:
Specific Files/Folders using find
from BusyBox
:
adb shell find "/sdcard/Folder1" -iname "*.jpg" | tr -d ' 15' | 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 ' 15' - 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.
脚本将从顶层文件夹开始,然后递归查找所有*.jpg"文件并将它们从您的手机拉到当前目录.
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.
这篇关于我如何 adb 拉取 SD 卡中存在的文件夹的所有文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!