I’m trying to move a file from one folder to another from the command line.
I’ve succeded in uploading a file using the curl command but no luck moving the file I’ve tried this command that I found in the documentation
curl -u user:pass -X MOVE --header ‘Destination: https://MY_ADDRESS/remote.php/dav/files/USER/DIRECTORY/’ https://MY_ADDRESS/remote.php/dav/files/USER/SOURCE
I get this error message
405 Method Not Allowed
Method Not Allowed
The requested method MOVE is not allowed for this URL.
If you are trying to move a file from one folder to another folder on the same server, you could use the operating system specific move command.
On linux for example you can do
mv /path/to/source_file /path/to/destination_file
If you really want to do it via cURL, you need to either use POST or PUT - MOVE is not a valid request method.
Valid Request methods: https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Request_methods
//EDIT: The above applies to cURL only - WebDav seems to have a MOVE command, so maybe there is an issue with the source/destination folder/file as mentioned by @gas85
After this action you must scan the nextcloud.
... php occ files:scan --all
According to the Doku, you made everything right.
Could you try PROPFIND to be sure that Source exist and exact what you want?
curl -u user:pass -X PROPFIND https://MY_ADDRESS/remote.php/dav/files/USER/SOURCE
Is your destination Folder exist?