android - "adb pull"抛出 "does not exist"

标签 android adb

当我执行命令时:
for el in $(adb shell ls /mnt/sdcard/ | grep mem_); do adb pull /mnt/sdcard/${el} android_mem; done
我得到:
' does not existmnt/sdcard/mem_AI ' does not existmnt/sdcard/mem_Alarms ' does not existmnt/sdcard/mem_Android ' does not existmnt/sdcard/mem_Autodesk ' does not existmnt/sdcard/mem_Cardboard ' does not existmnt/sdcard/mem_DCIM ...
但如果我执行此操作,例如 adb pull /mnt/sdcard/mem_DCIM android_mem我明白了0 KB/s (20 bytes in 0.080s) ,即好的。为什么会出现这种情况??

最佳答案

问题是 adb shell ls/mnt/sdcard/| grep mem_ 在末尾返回 \r,因此它无法正确提取文件。

因此您需要使用sed -r 's/[\r]+//g'删除它,例如:

for el in $(adb shell ls /mnt/sdcard/ | grep mem_ | sed -r 's/[\r]+//g'); do adb pull /mnt/sdcard/${el} android_mem; done

关于android - "adb pull"抛出 "does not exist",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31473442/

相关文章:

android - 从 Windows 7 x64 通过 "adb devices"通过 USB 看不到 Nexus 7

android - 在 Windows 8 上的 intellij 中找不到 USB 设备

Android Studio 未连接设备问题

android - 更新 Android 中 ormlite 数据库表中的所有列

java - 如何在 Android 应用程序中阻止或改善横向 View

android - 在android中编辑应用程序数据库

android - ListView 崩溃应用程序 :Java null Pointer Exception

android - 使用安卓 :id ="android:id/list"

android - 有没有办法在使用 Android Debug Bridge 安装应用程序时忽略 INSTALL_FAILED_VERSION_DOWNGRADE?

android - 使用 adb install 安装应用程序时如何获取堆栈跟踪?