### Example commands.txt for dav run Source: https://github.com/skshetry/webdav4/blob/main/docs/reference/cli.md An example file content showcasing how to define multiple 'dav' commands for batch execution. It includes copy, move, list, and disk usage commands, with support for comments. ```text cp dir/dir2 dav://path/to/dir mv dav://path/dir2 dav://path/dir3 # list all files (comments are supported) ls -R du ``` -------------------------------- ### Install webdav4 using pip Source: https://github.com/skshetry/webdav4/blob/main/README.md This command installs the core webdav4 library using pip. No additional dependencies are required for basic functionality. ```console pip install webdav4 ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/skshetry/webdav4/blob/main/CONTRIBUTING.md Installs the project's development dependencies using pip. Requires pip version 21.3 or higher for editable installs. This command installs the package in editable mode along with its development dependencies. ```shell pip install pip>=21.3 # required for editable installs pip install -e ".[dev]" ``` -------------------------------- ### Start WebDAV Test Server Source: https://github.com/skshetry/webdav4/blob/main/CONTRIBUTING.md Starts a local test server for webdav4. This server is used within the project's tests. It can be run directly or in an interactive mode. ```shell python -m tests.server ``` ```shell python -m tests.server -i ``` -------------------------------- ### Install webdav4 with fsspec support Source: https://github.com/skshetry/webdav4/blob/main/README.md Installs the webdav4 library along with the necessary dependencies for fsspec integration. This allows webdav4 to be used with the fsspec interface. ```console pip install webdav4[fsspec] ``` -------------------------------- ### Instantiate and use webdav4 with fsspec Source: https://github.com/skshetry/webdav4/blob/main/README.md Shows how to initialize a WebdavFileSystem object for use with the fsspec interface. This enables file system operations on WebDAV servers using a consistent API. Requires fsspec to be installed. ```python from webdav4.fsspec import WebdavFileSystem fs = WebdavFileSystem("https://webdav.com", auth=("username", "password")) fs.exists("Documents/Readme.md") fs.ls("Photos", detail=False) ``` -------------------------------- ### Install webdav4 CLI with fsspec Source: https://github.com/skshetry/webdav4/blob/main/docs/reference/cli.md Installs the webdav4 package along with the fsspec extra, which enables the 'dav' CLI functionality. This command ensures that the necessary dependencies for the CLI are available. ```shell pip install -U "webdav4[fsspec]" ``` -------------------------------- ### Run Project Tests Source: https://github.com/skshetry/webdav4/blob/main/CONTRIBUTING.md Executes all project tests using the pytest framework. It is expected that code changes include corresponding tests to ensure functionality. ```shell pytest ``` -------------------------------- ### Run Static Type Checking Source: https://github.com/skshetry/webdav4/blob/main/CONTRIBUTING.md Performs static type checking on the project using MyPy. This helps in identifying type errors before runtime, ensuring code robustness. ```shell mypy ``` -------------------------------- ### Instantiate and use webdav4 Client Source: https://github.com/skshetry/webdav4/blob/main/README.md Demonstrates how to create a webdav4 client instance and perform basic operations like checking existence, listing directories, and uploading files. Requires a WebDAV server URL and authentication credentials. ```python from webdav4.client import Client client = Client("https://webdav.com", auth=("username", "password")) client.exists("Documents/Readme.md") client.ls("Photos", detail=False) client.upload_file("Gorilla.jpg", "Photos/Gorilla.jpg") ``` -------------------------------- ### List Files using dav CLI Source: https://github.com/skshetry/webdav4/blob/main/docs/reference/cli.md Lists files and directories in the current remote directory. This is a basic command for inspecting the contents of the WebDAV server. ```shell dav ls ``` -------------------------------- ### Create Directory using dav CLI Source: https://github.com/skshetry/webdav4/blob/main/docs/reference/cli.md Creates a new directory on the remote WebDAV server. This command can be used with both local paths and remote WebDAV paths. ```shell dav mkdir path/dir dav mkdir dav://path/dir ``` -------------------------------- ### Run Multiple Commands at Once using dav CLI Source: https://github.com/skshetry/webdav4/blob/main/docs/reference/cli.md Executes a sequence of 'dav' commands specified in a file or piped from standard input. This allows for batch processing of multiple file operations. ```shell dav run commands.txt # or, cat commands.txt | dav run - ``` -------------------------------- ### Download File or Directory using dav CLI Source: https://github.com/skshetry/webdav4/blob/main/docs/reference/cli.md Copies a file or directory from the remote WebDAV server to the local filesystem. The -R flag is used for recursive copying of directories. ```shell dav cp dav://path/to/file file dav cp -R dav://path/to/file file ``` -------------------------------- ### Sync Files Periodically using dav CLI Source: https://github.com/skshetry/webdav4/blob/main/docs/reference/cli.md Synchronizes files intelligently between local and remote WebDAV locations, or between two remote locations. It uses file sizes and modification times to determine what needs to be synced. ```shell dav sync dir dav://path/to/dir # local to remote dav sync dav://path/to/dir dir # remote to local dav sync dav://path/dir1 dav://path/dir2 # remote-remote ``` -------------------------------- ### List Files Recursively using dav CLI Source: https://github.com/skshetry/webdav4/blob/main/docs/reference/cli.md Lists files and directories recursively from the current remote directory. The -R flag enables deep traversal of all subdirectories. ```shell dav ls -R ``` -------------------------------- ### Upload File or Directory using dav CLI Source: https://github.com/skshetry/webdav4/blob/main/docs/reference/cli.md Copies a file or directory from the local filesystem to the remote WebDAV server. The -R flag is used for recursive copying of directories. ```shell dav cp file dav://path/to/file dav cp -R dir dav://path/to/dir ``` -------------------------------- ### Count Files and Total Size using dav CLI Source: https://github.com/skshetry/webdav4/blob/main/docs/reference/cli.md Calculates and displays the total size of files within a specified directory on the WebDAV server. This command helps in understanding storage consumption. ```shell dav du path/dir ``` -------------------------------- ### List Files Recursively to Specific Depth using dav CLI Source: https://github.com/skshetry/webdav4/blob/main/docs/reference/cli.md Lists files and directories recursively up to a specified depth. The -L option limits the recursive listing to a certain number of subdirectory levels. ```shell dav ls -R -L2 ``` -------------------------------- ### Print File Contents using dav CLI Source: https://github.com/skshetry/webdav4/blob/main/docs/reference/cli.md Displays the content of a file located on the WebDAV server. This is useful for quickly viewing text-based files without downloading them. ```shell dav cat dav://path/to/file ``` -------------------------------- ### Set WebDAV Endpoint URL Environment Variable Source: https://github.com/skshetry/webdav4/blob/main/docs/reference/cli.md Configures the WEBDAV_ENDPOINT_URL environment variable, which the 'dav' CLI uses to connect to the WebDAV server. This URL can include user credentials and the server path. ```shell export WEBDAV_ENDPOINT_URL="https://user:password@webdav.server.org/remote.php/dav/files/user" ``` -------------------------------- ### Copy File or Directory within Remote using dav CLI Source: https://github.com/skshetry/webdav4/blob/main/docs/reference/cli.md Copies a file or directory from one location to another on the remote WebDAV server. The -R flag is used for recursive copying of directories. ```shell dav cp dav://path/to/file dav://path/to/file2 dav cp -R dav://path/to/dir1 dav://path/to/dir2 ``` -------------------------------- ### Move File or Directory within Remote using dav CLI Source: https://github.com/skshetry/webdav4/blob/main/docs/reference/cli.md Moves a file or directory from one location to another on the remote WebDAV server. The -R flag is used for recursive moving of directories. ```shell dav mv dav://path/to/file dav://path/to/file2 dav mv -R dav://path/to/dir1 dav://path/to/dir2 ``` -------------------------------- ### Delete File or Directory using dav CLI Source: https://github.com/skshetry/webdav4/blob/main/docs/reference/cli.md Removes a file or directory from the remote WebDAV server. The -R flag is used for recursive deletion of directories. ```shell dav rm dav://path/to/file dav rm -R dav://path/to/dir dav rm -R path/dir ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.