我有一个目录~/x7/music/sfx
。
的根目录中有一些文件和文件夹~/x7/music
。
我只需要同步sfx
文件夹并忽略music
.
我尝试了许多变体,但所有变体都是错误的。
ignore = Name music/*
ignorenot = Regex music/sfx/.* (OR just *)
不起作用。
我期待使用类似的东西
ignore = Name music/*^/
我有一个目录~/x7/music/sfx
。
的根目录中有一些文件和文件夹~/x7/music
。
我只需要同步sfx
文件夹并忽略music
.
我尝试了许多变体,但所有变体都是错误的。
ignore = Name music/*
ignorenot = Regex music/sfx/.* (OR just *)
不起作用。
我期待使用类似的东西
ignore = Name music/*^/
根据 unison 的文档,如果某个路径被忽略,那么下面的所有内容都会被忽略。因此,如果您想忽略文件夹中除子文件夹以外的所有内容,则不应忽略文件夹本身,而应忽略其中的所有内容(这是不同的),然后使用ignorenot
.
ignore = Path x7/music/?*
ignore = Path x7/music/.?*
ignorenot = Path x7/music/sfx
那应该这样做。
关于那里使用的特定正则表达式,我再次遵循一致的文档建议:“因此,将其Name *
作为忽略模式包含在内并不是一个好主意。如果您想忽略除特定文件集之外的所有内容,请使用Name ?*
. " 如果您有必要,第二ignore
行也会忽略 中的隐藏文件/文件夹。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/.*
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.
在 2.48.3 上,这应该有效:
ignore = Path /root/path/to/music/*
ignorenot = Path /root/path/to/music/sfx