android - "adb pull" throws "does not exist" -


when perform command:
for el in $(adb shell ls /mnt/sdcard/ | grep mem_); adb pull /mnt/sdcard/${el} android_mem; done
get:
' not existmnt/sdcard/mem_ai ' not existmnt/sdcard/mem_alarms ' not existmnt/sdcard/mem_android ' not existmnt/sdcard/mem_autodesk ' not existmnt/sdcard/mem_cardboard ' not existmnt/sdcard/mem_dcim ...
if perform this, example, adb pull /mnt/sdcard/mem_dcim android_mem 0 kb/s (20 bytes in 0.080s), ie ok. why happens??

the problem adb shell ls /mnt/sdcard/ | grep mem_ returning \r @ end, can't pull file properly.

so need remove sed -r 's/[\r]+//g', example:

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

Comments