I have a directory ~/x7/music/sfx
.
There are some files and folders in the root of ~/x7/music
.
I need to sync only the sfx
folder and ignore anything else in music
.
I've tried many variants, but all of them was wrong.
ignore = Name music/*
ignorenot = Regex music/sfx/.* (OR just *)
does not work.
I was expecting to use something like
ignore = Name music/*^/
I'm not familiar with unison, but to ignore everything except sfx you could use
ignore = Regex /root/path/to/music/.*
ignorenot Regex /root/path/to/music/sfx/.*
Documentation Source
There is also an
ignorenot
preference, which specifies a set of patterns for paths that should not be ignored, even if they match an ignore pattern. However, the interaction of these two sets of patterns can be a little tricky. Here is exactly how it works:
Unison starts detecting updates from the root of the replicas—i.e., from the empty path. If the empty path matches an
ignore
pattern and does not match anignorenot
pattern, then the whole replica will be ignored. (For this reason, it is not a good idea to includeName *
as anignore
pattern. If you want to ignore everything except a certain set of files, useName ?*.
)If the root is a directory, Unison continues looking for updates in all the immediate children of the root. Again, if the name of some child matches an
ignore
pattern and does not match anignorenot
pattern, then this whole path including everything below it will be ignored.If any of the non-ignored children are directories, then the process continues recursively.
Following unison's documentation, if a certain path is ignored then so does everything bellow it. So, if you want to ignore everything within a folder except a subfolder, you should not ignore the folder itself, but everything inside it (which is different), and then use ignorenot
.
ignore = Path x7/music/?*
ignore = Path x7/music/.?*
ignorenot = Path x7/music/sfx
That should do it.
Regarding the particular regexs used there, I'm following once again unison's documentation advice: "For this reason, it is not a good idea to include Name *
as an ignore pattern. If you want to ignore everything except a certain set of files, use Name ?*
."
The second ignore
line ignores also hidden files/folders within music
, if that's necessary for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With