WebDAV:使用cadaver删除带有空格的文件

时间:2018-12-08 11:42:03

标签: bash webdav cadaver

尸体应删除包含任意文件的垃圾箱(删除*)。当我想删除WebDAV目录中带有空格的文件时,出现404错误(空格经过URL编码/尸体,但似乎找不到编码的文件名)。

dav:!> open http://192.168.170.82:5005/
dav:/> cd TEST/recycle
dav:/TEST/recycle/> ls
Listing collection `/TEST/recycle/': succeeded.
   *testfile with spaces.txt              28  Aug 28 13:47
dav:/TEST/recycle/> delete *
[Matching... 1 match.]
Deleting `testfile%20with%20spaces.txt': failed:
404 Not Found
dav:/TEST/recycle/> quit
Connection to `192.168.170.82' closed.

列表(带有ls)文件可以正确列出。如果我将要删除的文件放在单引号中,则可以正常工作。

dav:!> open http://192.168.170.82:5005/
dav:/> cd TEST/recycle
dav:/TEST/recycle/> delete 'testfile with spaces.txt'
Deleting `testfile with spaces.txt': succeeded.
dav:/TEST/Papierkorb/> quit
Connection to `192.168.170.82' closed.

我该如何自动化呢?


我如何在bash中称呼尸体

{ echo "open http://192.168.170.82:5005/"
  echo "cd TEST/recycle"
  echo "ls"
  echo "delete *"
  echo "quit"
} | /bin/cadaver

0 个答案:

没有答案