Reputation: 1
I am trying to use ADB to pull files based on their filename containing certain characters. Phone is not rooted HTC One. PC is Windows 7.
I found this question: adb pull multiple files
The original code in that thread was:
adb shell ls /sdcard/gps*.trace | tr "\n\r" " " | xargs -n1 adb pull
I have modified it to:
ADB shell ls /mnt/sdcard/dcim/100Media/IMAG07* | tr "\r\n" " " | xargs -n1 adb pull \HTC2
When I run the code, I get an error that "'tr' is not recognized as an internal or external command, operable program or batch file."
What am I doing wrong? Thank you in advance!
Upvotes: 0
Views: 2064
Reputation: 1
Thank you for the help! I figured out what I was doing to make your code work. I am very new to this (5 days ago downloaded SDK for the first time) so it took a bit for me to work through the code. I added cmd \k at the end so the command prompt would stay open and I could verify what it had done.
rem@echo off
rem ======== Modify this line to your pattern =====
C:\Users\Neil\AppData\Local\Android\sdk1\platform-tools\adb shell ls /mnt/sdcard/dcim/100Media/IMAG09*.jpg >_temp
rem =================================================
setlocal EnableDelayedExpansion
for /f %%i in (_temp) do (
echo %%i>_temp
set /p file=<_temp
echo pulling file: !file!
C:\Users\Dan\AppData\Local\Android\sdk1\platform-tools\adb pull !file!
)
setlocal DisableDelayedExpansion
del _temp
cmd /k
Upvotes: 0
Reputation: 2351
There's no build-in "tr" or "xargs" command in windows. Here's my working batch script for windows. Modify the pattern and save it as a ***.bat file, copy it to the local directory(in your case the HTC2 folder), and double click it or run it in the cmd window in this folder.
@echo off
rem ======== Modify this line to your pattern =====
adb shell ls /sdcard/*.png >_temp
rem =================================================
setlocal EnableDelayedExpansion
for /f %%i in (_temp) do (
echo %%i>_temp
set /p file=<_temp
echo pulling file: !file!
adb pull !file!
)
setlocal DisableDelayedExpansion
del _temp
Upvotes: 1