1

I have two roots, /sync and ssh://bob@remotehost//sync. These roots contain three subfolders: paul, bob and sam. I currently sync them using the following script:

rsync -a --delete --delete-excluded --delete-after --force\
  /sync/paul/ bob@remotehost:/sync/paul
rsync -a --delete --delete-excluded --delete-after --force\
  bob@remotehost:/sync/bob/ /sync/bob
unison /sync/sam ssh://bob@remotehost//sync/sam

I want to create a unison profile that manages all three sub folders. So far I have the following:

# Define roots and paths
root = /sync
root = ssh://bob@remotehost//sync
path = paul
path = bob
path = sam

# Preserve timestamps
times = true

# Force single direction for some paths
forcepartial = Path paul/* -> /sync
forcepartial = Path bob/* -> ssh://bob@host//sync

Using this profile I expected all changes in /sync/paul to be propagated to ssh://bob@remotehost//sync/paul and all changes in /sync/paul to be forcibly deleted. I also expected vice versa for the path bob. However, this is not what I am seeing. In my test runs Unison wants to propagate new files and folders in both directions for both paths paul and bob.

How can I make Unison behave like rsync -a --delete --delete-excluded --delete-after --force $SOURCE/ $DEST for the paths bob and paul?

1 Answer 1

2

As it turns out forcepartial = Path paul/* -> ... does not match sub file- and foldernames beginning with a dot (e.g. paul/.config). However, one can use BelowPath paul or Regex paul/.* instead. The following use of BelowPath would achive my goal:

...
forcepartial = BelowPath paul -> /sync
forcepartial = BelowPath bob -> ssh://bob@host//sync

The same but using Regex instead:

...
forcepartial = Regex paul/.* -> /sync
forcepartial = Regex bob/.* -> ssh://bob@host//sync

This page suggests that the Regex keyword can be used to match subfolders as well, implying that forcepartial = Regex somefolder/.* -> ... would match the folder paul/somefolder and all its children. I have not experimented with this so I cannot say.

1
  • 1
    I can recommend not using Unison for syncing home folders for desktop users, at least not on a slow HD. The constant flux of state files for apps like Chromium, Firefox, etc makes the Unison index phase last an eternity on each sync session.
    – fuumind
    Aug 3, 2015 at 18:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .