1

I use Unison to sync stuff between some Linux devices. I want to have a profile set up where, if I'm running unison from machine A to sync between A and B, I can override my prefer = newer setting and preferpartial certain files from B over files from A, even if A's are newer.

Reading the docs, it seems like the only way I can do that is by setting up a socket on B, and either making sure I can refer to B by its hostname, or keep track of its IP address. This answer to another post seems to have confirmed that that is the way.

But that seems super roundabout for something that really shouldn't have been hard to implement as a simple option that doesn't need to refer to the other machine in a 2-machine operation by hostname or IP. Isn't there a simpler way?

Giacomo1968
  • 58,727

1 Answers1

0

Can you write an ignore pattern to match the certain files you are talking about? If so, what you could do is to use separate Unison profiles. First run Unison with a profile that does most of your syncing with all your prefer and preferpartial options, but ignore the files you're talking about. Then run Unison with a profile that is exactly the same except without the perfer or preferpartial or ignore options. The only changes that Unison will detect during that second run will be the files you wanted to prefer the copy on root A over the copy on root B. So you can just tell Unison to prefer root A in this second profile.