Search code examples
androidadbrootsu

Retrieve all folders using root (su) in ADB


How do I retrieve all folders using su in one command? Without root I use

adb shell "ls -R / | grep /"

And when I try

adb shell su "ls -R / | grep /"

it doesn't work. How must the syntax be to work?


Solution

  • Use the -c option of su to execute a command. You also need two levels of quotes --

    adb shell "su -c 'ls -R / | grep /'"