WebDAV Download Command Line Utility

I need a command line utility that can download WebDAV (HTTP PUT).

+51
webdav
Jul 30 '09 at 8:02
source share
9 answers

cURL will do it for you.

curl -T filetoput.xml http://www.url.com/filetoput.xml 
+76
Jul 30 '09 at 8:08
source share
β€” -

For Unix (and Windows with Cygwin installed) you can use Cadaver

+12
Jul 30 '09 at 8:11
source share

The most commonly used command line HTTP utility looks like cURL , which will PUT with it - the T parameter . However, you will need to understand quite a bit of the WebDAV protocol to do more than load with it.

+9
Jul 30 '09 at 8:08
source share

Free WinSCP (for Windows) supports WebDAV (and WebDAVS).
WinSCP also supports scripts / command line operations.

Example WinSCP script to upload a file via WebDAV:

 open https://user@webdav.example.com/ put file.txt /path/ exit 

Save the script to a file (for example, script.txt ) and run it like this:

 winscp.com /script=script.txt 

You can also put everything on one line:

 winscp.com /command "open https://user@webdav.example.com/" "put file.txt /path/" "exit" 

Start with an introduction to the script with WinSCP .

You can even have a WinSCP GUI to create a script file for you .

(I am the author of WinSCP)

+5
Jul 29 '14 at 14:24
source share

This overview contains a list of webdav servers and clients.

I would choose a corpse or, if my needs were very specific, a python script using the PyWebDAV library.

+3
Jul 30 '09 at 8:32
source share

Another option is "davix"

https://dmc.web.cern.ch/projects/davix/home

it shares utils as davix-mkdir davix-put etc. You can specify values ​​in the URL, for example

  davix-mkdir http://user:passw@example.com/dir_to_create davix-put local_file http://user:passw@example.com/dir_to_create/remote_file_name 
+3
Nov 26 '14 at 7:09
source share

Use KIO in KDE:

 kioclient cp file.txt 'webdavs://user@webdav.example.com:443/' 
+2
Apr 20 2018-12-21T00:
source share

If you need to download the entire directory instead of a single file via WebDAV, you can use the following approach.

Imagine that you have the following local folder that you are going to download via WebDAV.

 local_folder_to_upload β”‚ test.txt β”‚ test1.txt β”‚ └───nested_folder1 β”‚ β”‚ file1.txt β”‚ β”‚ file2.txt β”‚ β”‚ β”‚ └───nested_folder2 β”‚ β”‚ file11.txt β”‚ β”‚ file12.txt 

1. First you need to create subdirectories from your local folder (if any) on the server. Since WebDAV does not support recursive loading, you must do this in a separate step ( if you should use ftp , you would add --ftp-create-dirs to do this). To create these folders through WebDAV you need to use the MKCOL method .

 curl -X MKCOL 'http://your.server/uploads/nested_folder1' --user 'name:pwd' curl -X MKCOL 'http://your.server/uploads/nested_folder1/nested_folder2' --user 'name:pwd' 

Please note that you cannot create them in a single request according to the specification .

if a request is made to create the collection / a / b / c / d / and / a / b / c / does not exist, the request should fail.

2. Secondly, you can use the output of the find shell command to upload it to your server using curl .

 cd local_folder_to_upload && find . -exec curl -T {} 'http://your.server/uploads/{}' --user 'name:pwd' \; 

The above code iterates over all your files inside this directory (using find) and adds the output (file name with relative path) to the {} placeholder in your web server URL. Thus, he makes several requests (one for each file), and since all subfolders were created in advance, these requests should not fail.

Hope this will be helpful to someone.

+2
Nov 11 '18 at 10:00
source share

Teleric Fiddler has a Create tab where you can create your own custom WebDAV request. For example, PROPFIND, OPTIONS, etc.

0
Jun 18 '19 at 9:44
source share



All Articles