A simple and compact WebDAV client written in Python 3.
- All WebDAV operations supported
- Flexible listing, with optional recursion
- Proper error reporting
- Flexible instance targeting
- Python 3.12+
- Various packages, including
requests
To install the repository as a package run
pip3 install -e .Optionally, create a separate virtual environment and activate it.
Install the required packages using the requirements.txt file:
pip3 install -r requirements.txtYou need a configuration file in JSON format in order to allow the client to contact your WebDAV server. It must contain the following elements:
{
"hostname": "", ---> FQDN of host for WebDAV interaction
"endpoint": "", ---> WebDAV endpoint at host
"user": "", ---> User name
"token": "" ---> Your token
}
You can find the endpoint and credentials in the settings of your WebDAV installation, e.g. OwnCloud or NextCloud.
Use the config which will guide you through the process of adding a specific configuration. Multiple configurations are supported.
dav configTo switch to a different configuration, use:
dav config --use <name>In the following examples it is assumed the package is installed on the system.
General syntax:
dav <operation> [options] <source> [target]where operation is one of the valid operations available, source is the path to process and the optional target is the target path.
The optional options can be found through:
dav --helpThis list all available operations and options.
You can find more detailed information per operation through:
dav <operation> --help- List contents of your root folder:
dav list /- List contents of your folder 'my/excellent/folder', display subfolders first, show a summary at the end, sort alphabetically, show human-readable sizes:
dav list my/excellent/folder -tuh --sort- Create a folder 'folder' in root:
dav mkcol folder- Delete a folder 'folder' and auto-confirm:
dav delete folder -y- Rename a file
test.datstored in a foldertesttotest.txt:
dav move test/test.dat test/test.txt- Move a file
wrong.datstored in a folderdatato the root folder and rename it toright.dat:
dav move data/wrong.dat /right.dat- Copy a file
test.datstored in a foldertesttotest.txt:
dav copy test/test.dat test/test.txt- Download a file
test/test.txt
dav download test/test.txt- Upload a file
test.txtto foldertest:
dav upload test/test.txt test.txt