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 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? –  Radoo 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... :) –  Radoo 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. –  Radoo Apr 12 '12 at 22:26

5 Answers 5

up vote 1 down vote accepted

WebDav-sync is a java program designed for this purpose. http://www.re.be/webdav_sync/index.xhtml

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

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

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

WebDrive, www.WebDrive.com, will allow you to map a drive letter to your WebDAV Server. You could then use any sync tool like RoboCopy to sync your local folder with your WebDrive.

You could also use the interal Backup/Synchronization manager included in WebDrive. This would allow you to automate & schedule synchronization and/or backup of local folders out to your WebDAV server.

share|improve this answer

Your Answer

 
discard

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.