This is what I tried:

$ adb -e exec-out run-as com.awesomeproject rm *.jpg
rm: *.jpg: No such file or directory

After that I tried using find

$ adb -e exec-out run-as com.awesomeproject ls
app_textures files10.jpg files15.jpg files20.jpg files25.jpg files30.jpg
app_webview  files11.jpg files16.jpg files21.jpg files26.jpg files31.jpg
cache        files12.jpg files17.jpg files22.jpg files27.jpg lib
code_cache   files13.jpg files18.jpg files23.jpg files28.jpg lib-main
files        files14.jpg files19.jpg files24.jpg files29.jpg shared_prefs 


$ adb -e exec-out run-as com.awesomeproject find . -type f -name '*.jpg' -delete

But apparently the files are still there.

I'm not sure if this is because globstar is disabled but of course I can't activate it:

$ adb -e exec-out run-as com.awesomeproject shopt -s globstar
run-as: exec failed for shopt: Permission denied

So how do I get rid of multiple files at once using adb?

  • I believe the first command is misinterpreting the last operation within the command. Try giving it more explicit instructions: adb -e exec-out "run-as com.awesomeproject rm *.jpg". Other things to try include single quotes, combining, usage of escapes. Invoking an adb shell separating and throwing the commands one by one should work without issue. – Bo Lawson Nov 28 '18 at 15:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.