我的 SD 卡中有一个文件夹:/mnt/sdcard/Folder1/Folder2/Folder3/*.jpg
文件夹 1 和文件夹 2 的名称保持不变,文件夹 2 内有文件夹 3、4、5 等。
我想使用 adb 将所有 jpeg 文件而不是所有文件(还有更多)拉到计算机上的当前目录中。
每个文件夹都有不同的数字jpeg 文件和其他文件,我尝试使用这个:
adb pull mnt/sdcard/Folder1/Folder2/Folder/*.jpg .
但没有成功..
那么,嗯,我如何使用 adb 使用单个命令提取 SD 卡任何文件夹中存在的所有文件(单个命令,因为每个文件夹都有不同数量的文件)
单个文件/文件夹使用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.
特定文件/文件夹使用find
from BusyBox
:
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. The quotation marks around $line are required to work with filenames containing spaces.
脚本将从顶部文件夹开始,递归地向下查找所有“*.jpg”文件,并将它们从手机拉到当前目录。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)