1SYNCTHING-STIGNORE(5) Syncthing SYNCTHING-STIGNORE(5)
2
3
4
6 syncthing-stignore - Prevent files from being synchronized to other
7 nodes
8
10 .stignore
11
13 If some files should not be synchronized to other devices, a file
14 called .stignore can be created containing file patterns to ignore. The
15 .stignore file must be placed in the root of the folder. The .stignore
16 file itself will never be synced to other devices, although it can
17 #include files that are synchronized between devices. All patterns are
18 relative to the folder root.
19
20 NOTE:
21 Note that ignored files can block removal of an otherwise empty
22 directory. See below for the (?d) prefix to allow deletion of
23 ignored files.
24
26 The .stignore file contains a list of file or path patterns. The first
27 pattern that matches will decide the fate of a given file.
28
29 · Regular file names match themselves, i.e. the pattern foo matches the
30 files foo, subdir/foo as well as any directory named foo. Spaces are
31 treated as regular characters.
32
33 · Asterisk matches zero or more characters in a filename, but does not
34 match the directory separator. te*st matches test, subdir/telerest
35 but not tele/rest.
36
37 · Double asterisk matches as above, but also directory separators.
38 te**st matches test, subdir/telerest and tele/sub/dir/rest.
39
40 · Question mark matches a single character that is not the directory
41 separator. te??st matches tebest but not teb/st or test.
42
43 · Characters enclosed in square brackets [] are interpreted as a char‐
44 acter range [a-z]. Before using this syntax you should have a basic
45 understanding of regular expression character classes.
46
47 · A pattern beginning with / matches in the current directory only.
48 /foo matches foo but not subdir/foo.
49
50 · A pattern beginning with #include results in loading patterns from
51 the named file. It is an error for a file to not exist or be included
52 more than once. Note that while this can be used to include patterns
53 from a file in a subdirectory, the patterns themselves are still rel‐
54 ative to the folder root. Example: #include more-patterns.txt.
55
56 · A pattern beginning with a ! prefix negates the pattern: matching
57 files are included (that is, not ignored). This can be used to over‐
58 ride more general patterns that follow.
59
60 · A pattern beginning with a (?i) prefix enables case-insensitive pat‐
61 tern matching. (?i)test matches test, TEST and tEsT. The (?i) prefix
62 can be combined with other patterns, for example the pattern
63 (?i)!picture*.png indicates that Picture1.PNG should be synchronized.
64 On Mac OS and Windows, patterns are always case-insensitive.
65
66 · A pattern beginning with a (?d) prefix enables removal of these files
67 if they are preventing directory deletion. This prefix should be used
68 by any OS generated files which you are happy to be removed.
69
70 · A line beginning with // is a comment and has no effect.
71
72 · Windows does not support escaping \[foo - bar\].
73
74 NOTE:
75 Prefixes can be specified in any order (e.g. “(?d)(?i)”), but cannot
76 be in a single pair of parentheses (not “(?di)”).
77
78 NOTE:
79 Include patterns (that begin with !) cause Syncthing to traverse and
80 watch the entire directory tree regardless of other ignore patterns.
81
83 Given a directory layout:
84
85 .DS_Store
86 foo
87 foofoo
88 bar/
89 baz
90 quux
91 quuz
92 bar2/
93 baz
94 frobble
95 My Pictures/
96 Img15.PNG
97
98 and an .stignore file with the contents:
99
100 (?d).DS_Store
101 !frobble
102 !quuz
103 foo
104 *2
105 qu*
106 (?i)my pictures
107
108 all files and directories called “foo”, ending in a “2” or starting
109 with “qu” will be ignored. The end result becomes:
110
111 .DS_Store # ignored, will be deleted if gets in the way of parent directory removal
112 foo # ignored, matches "foo"
113 foofoo # synced, does not match "foo" but would match "foo*" or "*foo"
114 bar/ # synced
115 baz # synced
116 quux # ignored, matches "qu*"
117 quuz # synced, matches "qu*" but is excluded by the preceding "!quuz"
118 bar2/ # synced, despite matching "*2" due to child frobble
119 baz # ignored, due to parent being ignored
120 frobble # synced, due to "!frobble"
121 My Pictures/ # ignored, matched case insensitive "(?i)my pictures" pattern
122 Img15.PNG # ignored, due to parent being ignored
123
124 NOTE:
125 Please note that directory patterns ending with a slash some/direc‐
126 tory/ matches the content of the directory, but not the directory
127 itself. If you want the pattern to match the directory and its con‐
128 tent, make sure it does not have a / at the end of the pattern.
129
131 The Syncthing Authors
132
134 2014-2019, The Syncthing Authors
135
136
137
138
139v1 Jun 11, 2019 SYNCTHING-STIGNORE(5)