Unison: Ignore directory by name in all paths by using command line

2.2k views Asked by At

I'm currently using unison for syncing local files with my cloud. Therefore I have set up a batch file which contains all options I need.

"K:\unison\unison 2.48.4 text.exe" -batch -repeat 1200 -fastcheck true -log=false D:\localsync Z:\cloudsync

In order to tell unison to skip all folders with the name ".tmp" regardless of their path I came up with this command:

 "K:\unison\unison 2.48.4 text.exe" -batch -repeat 1200 -fastcheck true -log=false -ignore=Name{*.*.tmp} D:\localsync Z:\cloudsync

The *.*.tmp construct is recommend since unison ignores all names beginning with a dot.

Unfortunately, unison throws an error here when I run the batch file:

Uncaught exception Sys_error("C:\Users\name\.unison\*.tmp)

It then complains that the syntax for the directory name is wrong. Obviously, unison is reading the ignore statement and looking for a file with the name of the to be ignored folder in the .unison directory.

I couldn't come up with a solution to that. All information in the manual (https://www.cis.upenn.edu/~bcpierce/unison/download/releases/stable/unison-manual.html) sets ignore paths in the unison profile which I'm not using.

How's the way to get unison to ignore some directories when only using command line options?

1

There are 1 answers

1
Mike Pierce On

I think your syntax is wrong. Try

-ignore 'Name {*.*.tmp}'

From the Unison manual

Ignore patterns can also be specified on the command line, if you like (this is probably not very useful), using an option like -ignore 'Name temp.txt'.