Super User is a question and answer site for computer enthusiasts and power users. 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 want to sync the following locations using unison:

  • /home/user/Audiobooks with /shared/Audiobooks
  • /home/user/Music with /shared/Music
  • /home/user/Podcasts with /shared/Podcasts

What would the unison command line parameters be? Based on this, I can guess

If one or more path preferences are given, then Unison will synchronize only these paths and their children. (This is useful for doing a fast sync of just one directory, for example.) Note that path preferences are intepreted literally—they are not regular expressions.

Here's my guess. Is that correct?

unison -ui text /home/user /nocrypt/Shared -path Audiobooks -path Music -path Podcasts 

I could also use a profile. I read the help docs and found the an example that I adapted. I'm not sure it is correct, however.

Modified from the help docs: Here is a more sophisticated profile, illustrating some other useful features.

# Roots of the synchronization
root = /home/user
root = /shared

# Paths to synchronize 
path = Audiobooks
path = Music
path = Podcasts

Is that correct?

By the time I finished writing this question, I pretty much have it figured out. I think both methods above are correct. The great thing about unison is that you can do a "dry run" the same way you would do an actual sync. The default action is always "no action" (after all changes are presented). I'm going to test it now and see if it works. I guess I don't need an answer, but I'll leave this question here for reference (and answer it myself with a confirmation of whether or not this worked).

share|improve this question
up vote 3 down vote accepted

Yes, I am confirming what I stated in the question is correct.

share|improve this answer
hahahahaha this question is hilarious. Does this work as parameters to the GUI profiles, since they're basically just command line sets? – Trevor Alexander Feb 3 '14 at 6:12
This could be improved by re-working so the question reads like a question and likewise for the answer. – suspectus Mar 25 '15 at 19:04

Like your question, I'm posting this for reference.

You can mix and match variables. If you want to use shell variables, for example, you start with a profile as per usual, but pass the arguments that contain shell variables while invoking the command - the reason being that you cannot use those variables normally from within a profile file.

root = $HOME seems to work, but in root = ssh://host//$HOME, $HOMEis not recognised as a variable.

Example documents.prf:

# select folders
  path = Documents
  path = Desktop
# options
  batch = true

The command you could then use would look something like this:

unison documents -root $HOME -root ssh://user@remotehost//home/$USER
share|improve this answer

You must log in to answer this question.

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