文件模式¶
描述¶
如果某些文件应与其他设备同步或不同步, 配置相应SyncFilePattern
/IgnoreFilePattern
. 所有模式均相对于文件夹根 (进入DevMode
时选择的文件夹).
IgnoreFilePattern
的优先级高于SyncFilePattern
因此,如果您的模式都涵盖了同一文件,则该文件将被忽略。
模式语法¶
-
foo
(常规文件名) 与自己匹配, 即模式foo
匹配文件foo
,subdir/foo
as well as any directory namedfoo
. Spaces are treated as regular characters, except for leading and trailing spaces, which are automatically trimmed. -
*
(星号) matches zero or more characters in a filename, but does not match the directory separator.te*ne
matchestelephone
,subdir/telephone
but nottele/phone
. -
**
(双星号) matches as above, but also directory separators.te\*\*ne
matchestelephone
,subdir/telephone
andtele/sub/dir/phone
. -
?
(问号) matches a single character that is not the directory separator.te??st
matchestebest
but notteb/st
ortest
. -
[]
(方括号) denote a character range:[a-z]
matches any lower case character. -
{}
(大括号) denote a set of comma separated alternatives:{banana,pineapple}
matches eitherbanana
orpineapple
. -
\
(反斜线) “escapes” a special character so that it loses its special meaning. For example,\{banana\}
matches{banana}
exactly and does not denote a set of alternatives as above. Escaped characters are not supported on Windows. -
/
、./
(斜杠) 仅在文件夹根部开始的匹配模式。/foo
或./foo
匹配foo
但不匹配subdir/foo
. -
(?i)
(不敏感) 前缀开头的模式可以实现对案例不敏感的模式匹配。(?i)test
匹配test
,TEST
和tEsT
. The(?i)
prefix can be combined with other patterns, for example the pattern(?i)picture*.png
indicates thatPicture1.PNG
should be synchronized. On Mac OS and Windows, patterns are always case-insensitive.
可以按任何顺序指定前缀 (如 “(?i){foo,bar}/*/bar”), 但不能单一的括号 (不是 “{foo,(?i),bar}/*/bar”).
例子¶
给定目录布局:
以及以下配置:
IgnoreFilePattern
的优先级高于SyncFilePattern
,最终结果变为: