Reputation: 75
I need to fill out the SD card (0kb as free space), so, I am using the following batch to copy file "Maroon.file" (25mb) with different names on the sdcard (Maroon_1.file, Maroon_2.file, ...)
set counter=0
:COPYSMALLFILES
set /a counter=%counter% + 1
adb push Maroon.file /sdcard/Download/Maroon_%counter%.file | findstr /L "failed" | findstr /C:"failed to"
echo %errorlevel%
if %errorlevel%==1 (
GOTO COPYSMALLFILES
)
When the SD card has no more memory to copy any other file the adb push
gives this message "failed to copy 'Maroon.file' to '/sdcard/Download/Maroon_4.file': No space left on device
", I am trying to catch that message with the findstr
commands searching by the word "failed
", I have tested that command (findstr
) and works fine separated but with the adb push
command It does not work. Someone has any other idea?
Upvotes: 2
Views: 1730
Reputation: 11367
If so, then the error is probably being written out onto the stderr (2) stream instead of the stdout (1) stream. Add this stream redirect to your command. 2>&1
adb push Maroon.file /sdcard/Download/Maroon_%counter%.file
2>&1
| findstr /L "failed" | findstr /C:"failed to"
Upvotes: 1
Reputation: 496
I'm not sure I got exactly what you need; how about the grep command?
Upvotes: 0