加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

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

发布时间:2020-12-14 06:07:42 所属栏目:百科 来源:网络整理
导读:我有一个目录?/ x7 / music / sfx. ?/ x7 / music的根目录中有一些文件和文件夹. 我只需要同步sfx文件夹并忽略音乐中的任何其他内容. 我尝试过很多变种,但都错了. ignore = Name music/*ignorenot = Regex music/sfx/.* (OR just *) 不起作用. 我期待用类似
我有一个目录?/ 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.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读