Search code examples
androidshellcommand-lineterminaladb

adb command fail to execute if path contain spaces


I am trying to delete the file using adb command. But the file contain spaces. So adb command throws an error after reading half of the file name till space. Is there a way to overcome this issue. I am executing following adb command

When I execute

adb shell rm /sdcard/samsung_Nexus S_converter.xml

Error message: rm failed for /sdcard/samsung_Nexus, No such file or directory

How ever when I execute:

adb shell rm /sdcard/samsung_Nexus_S_converter.xml

File deletion is successful

I searched for solution for this, if there is any workaround. How ever I couldnt find any.


Solution

  • Since you are using command line, you need to know that spaces must be escaped by using (backslash before the special character like "space"), so, in your case this should work too:

    adb shell rm /sdcard/samsung_Nexus\ S_converter.xml

    Hope it helps!

    Regards!