一批文件从Android的复制到PC [英] Copy a batch of files from Android to PC
本文介绍了一批文件从Android的复制到PC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我写了一段脚本将一些文件从Android设备复制到我的电脑:
亚行外壳LS /sdcard/Download/0*.log> TMP
而读线
做
回声$线
亚行拉$线。
完成< TMP
RM TMP
不过,似乎有什么东西我错过了;这是行不通的。你能不能帮我指出来?
我:
/sdcard/Download/0810-192141.log
不existsdcard /下载/ 0810-192141.log
解决方案
你得到错误的原因是额外的 \\ r
字符上月底的 $行
。这应该工作:
ADB壳LS /sdcard/Download/0*.log| TR -d'\\ r'> TMP
而读线
做
回声$线
亚行拉$线。
完成< TMP
RM TMP
I wrote a piece of script to copy some files to my PC from an Android device:
adb shell ls /sdcard/Download/0*.log > tmp
while read line
do
echo $line
adb pull $line .
done < tmp
rm tmp
However, it seems there is something I missed; it does not work. Could you help me point it out?
I got:
/sdcard/Download/0810-192141.log
' does not existsdcard/Download/0810-192141.log
解决方案
The reason you're getting the error is the extra \r
character on the end of the $line
. This should work:
adb shell "ls /sdcard/Download/0*.log" | tr -d '\r' > tmp
while read line
do
echo $line
adb pull $line .
done < tmp
rm tmp
这篇关于一批文件从Android的复制到PC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文