Server Fault is a question and answer site for system and network administrators. 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 on my Mac that I want to sync with a WebDAV server.

There are a lot of files in my folder. After I edit some files or add/remove folders, I want 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
What operating system are you using? Would you care to elaborate as to why mounting the resource cannot be part of the solution? – Skyhawk Apr 12 '12 at 21:30
Mac OS X, so any *nix solution should work. I don't want to use mount as i need to have a local copy of the files as the files form webdav can be deleted/altered anytime, so i need my local copy and just sync when needed. – daniels Apr 12 '12 at 22:04
@daniels What does that have to do with mounting or not mounting the share? – Shane Madden Apr 12 '12 at 22:15
If i mount the files then i would edit them directly from there, right? I still need to have a local copy of the files, so should i just mount and then copy & paste from one place to another? – daniels Apr 12 '12 at 22:25
Hold on. If you prefer a GUI solution like copying and pasting, why not just use Cyberduck and be done with it? It's easy to configure your upload preferences to skip existing files. – Skyhawk Apr 13 '12 at 1:01
up vote 1 down vote accepted

You appear to be massively over-thinking this and by doing so are overlooking some really obvious solutions.

You say mounting is not a solution and then proceed to explain that this is because you think that by mounting the webdav folder you will be working with the remote documents directly. Have you considered mounting the remote folder AND having a local folder? Then you simply do your editing locally and when ready merely copy the contents to the webdav folder.

share|improve this answer
The files are code files. I most of the time i edit as much as a line of code then i need to upload it on webdav to see how it works and so on. And i have lots of files in lots of folders so just copying the files from one place to another at each small change will be a huge waste of time. – daniels Apr 13 '12 at 7:14
@daniels, then mount the wevdav folder, do your editing and use any file/folder sync tool to update your changes. – John Gardeniers Apr 14 '12 at 10:33

Mounting the resource isn't the total solution, but it can be part of it.

If you mount the WevDAV share, you can use robocopy /mir to mirror the contents of one directory to another. This should take care of your problem. Robocopy is well documented and highly script-able.

Edit: Since apparently you're on a Mac (minor detail, right?), you can just replace robocopy with rsync. It will still work the same.

share|improve this answer
Seems like it could work but i am on mac so i can;t use robocopy – daniels Apr 12 '12 at 22:07
Well, good thing you included that information in your question since we're not mind readers...oh wait. – MDMarra Apr 12 '12 at 22:08
No need to be upset here man, i just forgot this detail, and i did appreciated your answer and up voted it as it is a valid solution even if it is not in my case. So thanks. – daniels Apr 12 '12 at 22:23
rsync -a /source user@ssh_host:/path/to/destination

That'll do it right there. rsync also will only transfer those files which have changed. It is HIGHLY recommended that you not use rsync (or any copy method) on any active database file. For example, for MySQL, it is recommended that you use mysqldump to export the database to a text file beforehand.

share|improve this answer
I only have text files, images, etc.... Does rsync work over WebDav? – daniels Apr 12 '12 at 22:06
Doesn't rsync have an option to copy locked files without harming them? I know robocopy does. – djangofan Apr 12 '12 at 23:49
This won't work over WebDAV. The remote server would need to allow ssh/sftp connections. – Skyhawk Apr 13 '12 at 1:03

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.