Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm facing a rather simple situation, I have to upload, as-is, a big tree of files to a WebDAV server that's reachable over HTTPS. I must start the upload from a linux box with command line only. I can install programs on the box.

I've tried Cadaver but it does not support recursive directory upload.

Do you know of simple tools/scripts to achieve that?

Ok, I found something that did it.

I started from the davpush.pl script that can be found here https://github.com/ptillemans/davpush

Some changes were needed:

  • replace all "dav://" to "https://"
  • add "print POUT "open";" before "print POUT $script;"

Damn, having to hack a perl script to simply upload a directory that's rude. I'm still looking for simple tools/scripts.

share|improve this question

migrated from stackoverflow.com Dec 23 '12 at 0:59

This question came from our site for professional and enthusiast programmers.

2 Answers 2

up vote 2 down vote accepted

Try gnomevfs-copy:

Edit: gvfs-copy is not recursive. I patched it but yet havi to publish the code. In the meantime, check dave from perldav. It does recursive transfers.

If you don't have fuse disabled, you can try davfs2

If you are not adverse to code your own tool, you could use gvfs and get inspiration from the source code of gvfs-copy

I'm having a similar issue, so I may come back with a better solution

share|improve this answer
kio-client could have done it too. Unfortunately it's a quite restricted box and I don't have gnomevfs-copy nor kio-client installed. –  eskatos Apr 2 '13 at 11:30
Try dave if you can. It works recursively (but unfortunately to me, it doesn't understand multistatus response from the server) –  user36520 Apr 5 '13 at 12:07
dave did it with the target server, thanks! In fact it's not so far from what I did based on the davpush script that use cadaver itself using the perl HTTP::DAV API. But with dave, one cannot easily write a shell script with a bunch of commands because it is interactive only. Answer accepted :) –  eskatos Apr 5 '13 at 12:13

Here is a quickly hacked shell script that permits to do that by using cadaver:


usage () { echo "$0 <src> <cadaver-args>*" >/dev/stderr; }
error () { echo "$1" >/dev/stderr; usage; exit 1; }

test $# '<' 3 || \
    error "Source and cadaver arguments expected!";

src="$1"; shift;
test -r "$src" || \
    error "Source argument should be a readable file or directory!";

cd "$(dirname "$src")";
src="$(basename "$src")";
    find "$src" '(' -type d -a -readable ')' \
    -printf 'mkcol "%p"\n';
    find "$src" '(' -type f -a -readable ')' \
    -printf 'cd "%h"\nlcd "%h"\n'            \
    -printf 'mput "%f"\n'                    \
    -printf 'cd -\nlcd "'"$root"'"\n';
    echo "quit";
} > "$rc";

cadaver -r "$rc" "$@";
rm -f "$rc";

If it is named, say, davcpy.sh, then a command like davcpy.sh "<local-directories>/<dirname>" "https://<target-website>/<some-directories>/" allows to recursively copy a directory <dirname> into a remote one named <some-directories>/<dirname>.

Note that it uses the scripting facility of cadaver to still permit interactive typing of login/passwords ; I think it is also robust to weird file and directory names containing spaces, but I did not tested any case like that.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.