unison
unison copied to clipboard
Add option to synchronize directory timestamp
unison provides the -times option, which synchronizes modification times for files. I would find it useful to synchronize modification times for folders as well. This is possible with other tools, e.g. rsync.
(I could try and implement the feature myself and submit a patch, but I would need some hints regarding the place in the code where modification time synchronization is implemented, since I am not familiar with unison's source code.)
This would be a nontrivial change, unfortunately -- the places you'd have to touch are spread across the change detection (update.ml), reconciliation (recon.ml), and propagation (transport.ml) phases, and some of the code is pretty complex.
an option is to run rsync after unison to sync dir times but you have to be careful of the exceptions in your unison profile.
I am currently using rsync to synchronize between different computers. It requires some discipline because I always have to check out the current state from a server before I start working and then push the modification before I shut down my computer.
I would like to use unison instead because it allows to choose interactively how to reconcile individual files and their properties (including the files' timestamps). Unfortunately I cannot reconcile folder timestamps in the same way and this means that after reconciling a folder from different computers, the folder timestamp will not be the time I last worked on that folder but the time I last reconciled it.
I have looked into the code and indeed it is quite complex and I am afraid that at the moment I cannot invest enough time to contribute something meaningful. If I get some more time to work on this I will give it another try.
Workaround: afterwards, run:
rsync -r --times --size-only --existing
The problem with using vanilla rsync is that it won't sync bidirectionally, which is the main strength of unison.