adb shell remove directory with patenthesis windows I'm trying to delete a directory that contains parenthesis in its name. So far I've tried:

adb shell rm -r "sdcard/music/SomeArtist - (good stuff)"


And I get:

/system/bin/sh: syntax error: '(' unexpected


I'm on windows btw. Any suggestion? Cheers
The problem is that the quotes are being interpreted twice: once by the Windows shell when it parses the adb command, and again by the Android shell. Remember that adb shell foo opens a shell on the device and runs the foo command there. When you run

adb shell rm -r "sdcard/music/SomeArtist - (good stuff)"


Windows is using the quotes to see the whole path as one argument, and then removes them. The command that actually gets sent to the device is then

rm -r sdcard/music/SomeArtist - (good stuff)


and the shell on the device interprets the ( as a special shell expansion. There are two ways to avoid this. One way is to double the quotes, so that there's still a set left when the command gets to the device:

adb shell rm -r "\"sdcard/music/SomeArtist - (good stuff)\""


The second, and more generally useful, is to avoid trying to do everything at once. Use adb shell to open an interactive shell on the device, and then

rm -r "sdcard/music/SomeArtist - (good stuff)"


inside that shell to run the command you want. You can use ctrl-d to exit the shell when you're done.