unison

Unison: sync only in one direction ...option selected in profile


I'm effectively asking this question: Unison: sync only in one direction but I'd like to apply the accepted answer to a profile script. Can I do that?

unison /src/dir /dest/dir -force /src/dir -nodeletion /dest/dir

Cheers!


Solution

  • Yes, of course you can write that command line to the profile script.

    1. Locate the corresponding .prf unison preferences/profile file (usually under $HOME/.unison, but please double check, this may vary depending on your OS or Unison installation)
    2. Edit the .prf file and add the following:
        # Unison preferences
        label = Sync in only one direction (mirror)
        root = /src/dir
        root = /dest/dir
        force = /src/dir        # force changes from this replica to the other
        nodeletion = /dest/dir  # prevent file deletions on this replica
        noupdate = /src/dir     # prevent file updates on this replica
    

    You can also replace step #1 above by creating a new preferences profile using the Profile Editor in the GUI, or your text editor of choice. Please remember the name and location of this file (e.g. $HOME/.unison/sync-one-direction.prf). Then you can call unison from the command line like this:

    unison $HOME/.unison/sync-one-direction.prf
    

    or

    unison -i 
    

    The latter will start an interactive profile selection.

    HTH