Welcome to the NZRT Wiki Podcast. Today we’re looking at WebDAV Cheatsheet.
WebDAV is a protocol that lets you interact with files stored on a server over HTTP. For NZRT, that means you can upload, download, move, copy, and delete files on Nextcloud programmatically, without ever opening a browser. Every operation you’ll see today targets a base endpoint on the Nextcloud server, structured around a path that includes the word “dav”, then “files”, then your username. That username part is important — every command you run needs to be tailored to the account you’re working with.
Let’s start with the basics. To upload a file, you send a PUT request to Nextcloud using curl. You authenticate with your username and password, point curl at the file on your local machine, and specify the destination path on Nextcloud where you want it to land. That’s it — one command, file is uploaded.
Downloading is the reverse. You send a GET-style request with your credentials, provide the remote file path, and tell curl where to save it locally. Simple and reliable.
Now, listing files works a little differently. WebDAV uses a special request type called PROPFIND, which asks the server to return properties about files and folders. You add a header that tells the server you want to look one level deep — so you see the contents of a folder without recursing into subfolders. You also pass a small XML body that asks for file properties. The server responds with an XML document describing everything in that folder.
Deleting a file is straightforward — you send a DELETE request with your credentials and the path to the file. No confirmation prompt, so be deliberate.
Creating a folder uses another WebDAV-specific request type called MKCOL, short for “make collection.” You point it at the path where you want the new folder, authenticate, and Nextcloud creates it.
Copying a file involves a COPY request. You point curl at the source file, and you add a Destination header that specifies where the copy should end up. Both paths need to be full URLs on the server.
Moving or renaming a file works the same way — you use a MOVE request instead, with a Destination header pointing to the new path or new name. One command handles both renaming and relocating.
If you need file metadata — things like content type, file size, last modified date, or an internal file ID — you use PROPFIND again, but this time against a specific file rather than a folder, and you pass a more detailed XML body listing exactly which properties you want back.
Now for the more powerful stuff. There’s a bulk upload script that loops through all PDF files in your current directory and uploads each one to a specific remote folder on Nextcloud. You set four variables at the top: the server URL, your username, your password, and the remote path — in the example that’s a Finance invoices folder for April 2026. The script then iterates over every PDF it finds and fires off a PUT request for each one, printing a confirmation line after each upload.
The bulk download script does the opposite. It first runs a PROPFIND to list files in a remote folder, extracts the file paths from the XML response, then loops through them and downloads each one to your current local directory.
You can also mount Nextcloud as a drive on Linux. You install a package called davfs2, then run a mount command pointing at the WebDAV URL, specifying a local mount point and your username. You’ll be prompted for your password. Once mounted, you interact with Nextcloud files exactly like a local folder. To disconnect, you run the unmount command.
On Windows, it’s even simpler. Open File Explorer, choose Map Network Drive, paste in the WebDAV URL with your username at the end, check the option to connect with different credentials, and enter your Nextcloud username and password. Nextcloud appears as a mapped drive in Explorer.
There’s also a practical NZRT example in the cheatsheet — a nightly invoice sync. This script queries the Dolibarr database for invoices created in the last day, then uploads each matching PDF from the local Dolibarr invoices folder to Nextcloud under the Finance invoices path. This is the kind of automation WebDAV was built for: bridging your ERP system and your file server without any manual steps.
To put it in context for NZRT — WebDAV is the glue that connects Nextcloud to your other systems. Whether you’re syncing Dolibarr invoices, running nightly backups, or building integrations with third-party tools, WebDAV gives you a consistent, scriptable interface to your Nextcloud storage. Related topics worth reading alongside this one include the REST API and WebDAV overview, the Nextcloud CLI Cheatsheet, and the Dolibarr Integration notes.
That’s it for this episode of the NZRT Wiki Podcast. Thanks for listening.