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.
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.
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.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.