正则表达式 – 忽略除一个子文件夹之外的目录中的所有内容

前端之家收集整理的这篇文章主要介绍了正则表达式 – 忽略除一个子文件夹之外的目录中的所有内容前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个目录〜/ x7 / music / sfx.
〜/ x7 / music的根目录中有一些文件文件夹.
我只需要同步sfx文件夹并忽略音乐中的任何其他内容.

我尝试过很多变种,但都错了.

ignore = Name music/*
ignorenot = Regex music/sfx/.* (OR just *)

不起作用.

我期待用类似的东西

ignore = Name music/*^/

解决方法

我不熟悉unison,但要忽略除了sfx之外的一切你可以使用

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 an ignorenot pattern,then the whole replica will be
    ignored. (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 ?*.)

  • 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 an ignorenot
    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.

猜你在找的正则表达式相关文章