我想将文件上传到我的 nextcloud 服务器。问题是我有一个错误。第一个 curl 命令应该创建目录。
curl -u "$USER":"$PW" -X MKCOL "https://MYSERVER/remote.php/dav/files/$USER/$MANY_DIRECTORIES"
curl -u "$USER":"$PW" -T "$FILE" "https://MYSERVER/remote.php/dav/files/$USER/$MANY_DIRECTORIES/$FILE"
如果$MANY_DIRECTORIES
只包含一个目录,它可以工作。但是如果这个变量包含 eg/root/deep/deeper
并且deep
不存在我得到这个错误:
<?xml version="1.0" encoding="utf-8"?>
<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
<s:exception>Sabre\DAV\Exception\Conflict</s:exception>
<s:message>Parent node does not exist</s:message>
</d:error>
第二个命令抛出此错误:
<?xml version="1.0" encoding="utf-8"?>
<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
<s:exception>Sabre\DAV\Exception\NotFound</s:exception>
<s:message>File with name //test could not be located</s:message>
</d:error>
那么如何创建递归目录来上传文件呢?
谢谢。