Skip to content

Access via cURL

Since WebDAV is an extension of the HTTP protocol, cURL can be used to script file operations.

  1. To create a folder with the current date as name:

    Terminal
    $ curl -u user:pass -X MKCOL "https://example.com/nextcloud/remote.php/dav/files/USERNAME/$(date '+%d-%b-%Y')"
    
  2. To upload a file error.log into that directory enter:

    Terminal
    $ curl -u user:pass -T error.log "https://example.com/nextcloud/remote.php/dav/files/USERNAME/$(date '+%d-%b-%Y')/error.log"
    
  3. To move a file enter:

    Terminal
    $ curl -u user:pass -X MOVE --header 'Destination: https://example.com/nextcloud/remote.php/dav/files/USERNAME/target.jpg' https://example.com/nextcloud/remote.php/dav/files/USERNAME/source.jpg