adb command fail to execute if path contain spaces

前端 未结 3 495
再見小時候
再見小時候 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: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      
    

提交回复
热议问题