android - Check if directory exists using ADB and push a file if it does -
i need able test , see if directory exists on sd card of android device , push few files directory if exist.
so far, have this:
adb %argument% shell if [ -e /sdcard/ ]; echo "it exist"; else echo "it not exist"; fi; but how can let batch script know directory exists can continue push file directory?
here have done in batch script:
set cmd="adb shell ls | find /c "thefile" " /f %%k in (' !cmd! ') set test=%%k if !test! gtr 0 ( echo file exists ) else ( echo file not exist ) there multiple files fit filename, chose have test greater 0.
to test exact match , using bash in linux (reference):
filename_result=$(adb shell ls / | tr -d '\015'|grep '^filename$') if [ -z "$filename_result" ]; echo "no filename found." else echo "filename found." fi
Comments
Post a Comment