我的SD卡中有一个文件夹:

Folder1和Folder2的名称保持不变,在Folder2中有Folder3、Folder4、Folder5等等. 我想使用ADB将所有的jpeg文件而不是所有的文件(还有更多)拉到计算机上的当前目录.

每个文件夹都有different number个jpeg文件和其他文件,我try 使用以下方法:

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

但它没有起作用..

推荐答案

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.

Specific Files/Folders using 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"文件,并将它们从您的手机拉到当前目录.

Android相关问答推荐

Android:点击操作栏返回按钮后应用程序无react

如何在点击按钮时将字符串插入到文本字段中的光标位置?

AdMob:MobileAds. initialize()—java. lang. xml对于某些设备不能强制转换为java. lang. String""

Jetapck Compose:将Compose BOM更新为最新版本&2024.01.00&Quot;CircularProgressIndicator后出现错误

属性可选的涟漪效果ItemBackEarth Borderless不适用于Android 13和更高版本

在Jetpack Compose中从LazyColumn中删除项目时发生IndexOutOf边界异常

Jetpack编写错误(java.lang.NoSuchMethodError:无接口方法startRestartGroup)

无法加载类';com.android.build.api.extension.AndroidComponentsExtension';

Jetpack Compose 绘制范围内的动画

在 Material 3 TopAppBar 代码的哪个位置定义了填充?

当手表与手机断开连接时,有没有办法在我的 Wear OS 应用程序中显示操作系统级别的图标?

如何用jetpack compose实现垂直李克特量表

状态更改后 colored颜色 未正确更改

Jetpack Compose 动画的行为是什么?

是否可以在 Kotlin 中为 mutableStateOf() 设置自定义设置器

如何修复 api 调用在浏览器中工作但在 android studio 中为 403

为什么我在 Jetpack Compose 中被警告可选修饰符参数应该具有默认值修饰符?

使用 Room 在 SQLite 中保存复杂的 JSON 响应

Google Play 控制台您的应用是否使用广告 ID?

未使用的内容填充参数