Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a local folder that i want to sync with a webdav server. There are a lot of files in my folder and i would need that after i edit some files or add/remove folder to be able to sync the changes to the webdav server ignoring what it is on the server and always using my files. Is there any script or tool that i can use from command line to do that?

And mounting the resource is not a solution.

share|improve this question
In which OS are you interested in? – user127350 Apr 12 '12 at 21:30
I'm on MacOS X, so something *nix based. I am aware about curl, or cadavre, but i couldn't fid a way so sync a whole folder. I only managed to upload/remove 1 file at a time. – daniels Apr 12 '12 at 22:01
And you don't want to mount anything from WebDAV url... Tough... :) – user127350 Apr 12 '12 at 22:11
Yes, mounting is not an option. Because if i mount i would need to have 2 copies of the same files in 2 different places and sync those too. – daniels Apr 12 '12 at 22:22
Perhaps I'm mistaking, but mounting doesn't mean copying, just linking to the WebDAV folder, everything you see on the mounted folder is what is on the server. For example, every listing you do is sent to the server to resolve. So all you have to do is just sync the mounted folder with your copy folder on disk... This is easy... google it. – user127350 Apr 12 '12 at 22:26
up vote 1 down vote accepted

WebDav-sync is a java program designed for this purpose.

share|improve this answer
mkdir /volumes/web_dav/
mount_webdav -s -i https://<web_dav_domain_name:port>/ /volumes/web_dav/

rsync -rvz /your_directory/ /volumes/web_dav/

umount /volumes/web_dav/
share|improve this answer

Using rsync on a mounted webdav drive may lose its incremental backup efficiency. The checksum algorithm on rsync makes remote files (full or a part) to download and store locally, then may waste download bandwidth.

A non-perfect solution is to use the flag "--size-only" to save bw:

rsync -ahvP --size-only /your/source/path /your/webdav_mount/path/

It won't work if files are then updated but still have the same sizes.

share|improve this answer

It seems that a quick solution to perform such one-way synchronization, is to re-use and modify the script I proposed as answer here by just adding something like test -d "$src" && echo "rmcol \"$src\""; right after the line with a single opening bracket.

Notice this involves re-transmitting all the contents each time, so use it only for "small" directories; otherwise, the solution resorting to mounting and using rsync would be much more appropriate.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .