adb command fail to execute if path contain spaces

前端 未结 3 457
再見小時候
再見小時候 2021-01-20 22:46

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 o

相关标签:
3条回答
  • 2021-01-20 23:24

    Did you tried escaping the space

    adb shell rm /sdcard/samsung_Nexus\ S_converter.xml

    0 讨论(0)
  • 2021-01-20 23:31

    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!

    0 讨论(0)
  • 2021-01-20 23:31

    By me it wasn't enough to escape spaces with backslashes:

    $ adb shell ls /storage/sdcard1/audio/Die\ Toten\ Hosen/
    /storage/sdcard1/audio/Die: No such file or directory
    Toten: No such file or directory
    Hosen/: No such file or directory        
    

    For some reason I also had to surround the path with '':

    $ adb shell ls '/storage/sdcard1/audio/Die\ Toten\ Hosen/'                                                                                                                       
    03 - Boxed Set                                                                                                                                                                                                     
    04 - Compilations                                                                                                                                                                                                  
    05 - Live Albums                             
    

    While surrounding without escaping didn't work:

    $ adb shell ls '/storage/sdcard1/audio/Die Toten Hosen'                                                                                                                       
    /storage/sdcard1/audio/Die: No such file or directory                                                                                                                                                              
    Toten: No such file or directory                                                                                                                                                                                   
    Hosen: No such file or directory      
    
    0 讨论(0)
提交回复
热议问题