a-schild/nextcloud-java-api

Move a file into a NextCloud folder

mhalkiad opened this issue · 2 comments

Hi all,
I am trying to move a file from one folder to another. Any help or example?

Thank you in advance.

This is not yet implemented.
https://docs.nextcloud.com/server/latest/developer_manual/client_apis/WebDAV/basic.html#moving-files-and-folders-rfc4918

We would need to use the move method from the sardine library

void move(String sourceUrl, String destinationUrl)

This moves a file from one location to another on the remote server. It assumes you want to overwrite all files.

Sardine sardine = SardineFactory.begin("username", "password"); 
sardine.move("http://yourdavserver.com/adirectory/file1.jpg", "http://yourdavserver.com/adirectory/file2.jpg");

It should be implemented in the api/webdav/Files.java file, similar to the upload method.
I would accept a merge request for this ;)

Is implemented in the 11.5.0 release