1SYNCTHING-STIGNORE(5)              Syncthing             SYNCTHING-STIGNORE(5)
2
3
4

NAME

6       syncthing-stignore  -  Prevent  files  from being synchronized to other
7       nodes
8

SYNOPSIS

10          .stignore
11

DESCRIPTION

13       If some files should not be synchronized to (or from) other devices,  a
14       file  called  .stignore  can be created containing file patterns to ig‐
15       nore. The .stignore file must be placed  in  the  root  of  the  synced
16       folder.  The  .stignore  file  itself will never be synced to other de‐
17       vices, although it can #include files that are synchronized between de‐
18       vices.  All  patterns are relative to the synced folder root.  The con‐
19       tents of the .stignore file must be UTF-8 encoded.
20
21       NOTE:
22          Note that ignored files can block removal of an otherwise empty  di‐
23          rectory.  See below for the (?d) prefix to allow deletion of ignored
24          files.
25

PATTERNS

27       The .stignore file contains a list of file or path patterns. The  first
28       pattern that matches will decide the fate of a given file.
29
30       • Regular file names match themselves, i.e. the pattern foo matches the
31         files foo, subdir/foo as well as any directory named foo. Spaces  are
32         treated  as  regular characters, except for leading and trailing spa‐
33         ces, which are automatically trimmed.
34
35Asterisk (*) matches zero or more characters in a filename, but  does
36         not  match  the  directory  separator.  te*ne matches telephone, sub‐
37         dir/telephone but not tele/phone.
38
39Double asterisk (**) matches as above, but also directory separators.
40         te**ne matches telephone, subdir/telephone and tele/sub/dir/phone.
41
42Question  mark  (?) matches a single character that is not the direc‐
43         tory separator. te??st matches tebest but not teb/st or test.
44
45Square brackets ([]) denote a  character  range:  [a-z]  matches  any
46         lower case character.
47
48Curly  brackets  ({})  denote  a set of comma separated alternatives:
49         {banana,pineapple} matches either banana or pineapple.
50
51Backslash (\) “escapes” a special character so that it loses its spe‐
52         cial  meaning.  For  example, \{banana\} matches {banana} exactly and
53         does not denote a set of alternatives as above.
54
55       NOTE:
56          Escaped characters are not supported on Windows, where \ is the path
57          separator.  If  you  still  need  to match files that have square or
58          curly brackets in their names, one possible workaround is to replace
59          them  with  ?, which will then match any character. For example, you
60          can type ?banana? to match both [banana] and {banana}, and so on.
61
62       • A pattern beginning with / matches in the root of the  synced  folder
63         only.  /foo matches foo but not subdir/foo.
64
65       • A  pattern  beginning  with #include results in loading patterns from
66         the named file. It is an error for a file to not exist or be included
67         more  than once. Note that while this can be used to include patterns
68         from a file in a subdirectory, the patterns themselves are still rel‐
69         ative to the synced folder root. Example: #include more-patterns.txt.
70
71       • A  pattern  beginning  with  a ! prefix negates the pattern: matching
72         files are included (that is, not ignored). This can be used to  over‐
73         ride more general patterns that follow.
74
75       • A  pattern beginning with a (?i) prefix enables case-insensitive pat‐
76         tern matching. (?i)test matches test, TEST and tEsT. The (?i)  prefix
77         can  be  combined  with  other  patterns,  for  example  the  pattern
78         (?i)!picture*.png indicates that Picture1.PNG should be synchronized.
79         On Mac OS and Windows, patterns are always case-insensitive.
80
81       • A pattern beginning with a (?d) prefix enables removal of these files
82         if they are preventing directory deletion. This prefix should be used
83         by any OS generated files which you are happy to be removed.
84
85       • A  line  beginning  with  // is a comment and has no effect. The same
86         double slashes in any other place  are  interpreted  literally,  e.g.
87         trying  to  do  file  //  comment will make Syncthing look for a file
88         called file // comment.
89
90       NOTE:
91          Prefixes can be specified in any order (e.g. “(?d)(?i)”), but cannot
92          be in a single pair of parentheses (not “(?di)”).
93
94       NOTE:
95          Include patterns (that begin with !) cause Syncthing to traverse the
96          entire directory tree regardless of other ignore patterns.   If  the
97          watcher  is  enabled,  the  entire directory tree will be watched as
98          well.
99
100          Top-level include patterns are treated as special cases and will not
101          force  Syncthing  to  scan (or watch) the entire directory tree. For
102          example: !/foo is a top-level include pattern,  while  !/foo/bar  is
103          not.
104

EXAMPLE

106       Given a directory layout starting at the synced folder’s root:
107
108          .DS_Store
109          .stignore
110          foo
111          foofoo
112          bar/
113              baz
114              quux
115              quuz
116          bar2/
117              baz
118              frobble
119          My Pictures/
120              Img15.PNG
121
122       and an .stignore file with the contents:
123
124          (?d).DS_Store
125          !frobble
126          !quuz
127          foo
128          *2
129          qu*
130          (?i)my pictures
131
132       all  files  and  directories  called “foo”, ending in a “2” or starting
133       with “qu” will be ignored. The end result becomes:
134
135          .DS_Store     # ignored, will be deleted if gets in the way of parent directory removal
136          foo           # ignored, matches "foo"
137          foofoo        # synced, does not match "foo" but would match "foo*" or "*foo"
138          bar/          # synced
139              baz       # synced
140              quux      # ignored, matches "qu*"
141              quuz      # synced, matches "qu*" but is excluded by the preceding "!quuz"
142          bar2/         # synced, despite matching "*2" due to child frobble
143              baz       # ignored, due to parent being ignored
144              frobble   # synced, due to "!frobble"
145          My Pictures/  # ignored, matched case insensitive "(?i)my pictures" pattern
146              Img15.PNG # ignored, due to parent being ignored
147
148       NOTE:
149          Please note that directory patterns ending with a slash  some/direc‐
150          tory/  matches  the  content of the directory, but not the directory
151          itself. If you want the pattern to match the directory and its  con‐
152          tent, make sure it does not have a / at the end of the pattern.
153
154       New  in  version  1.19.0: Default patterns can be configured which will
155       take effect when automatically accepting a folder from a remote device.
156       The  GUI  suggests same the patterns when adding a folder manually.  In
157       either case, the .stignore file is created with these defaults if  none
158       is present yet.
159
160

AUTHOR

162       The Syncthing Authors
163
165       2014-2019, The Syncthing Authors
166
167
168
169
170v1.22.2                          Dec 29, 2022            SYNCTHING-STIGNORE(5)
Impressum