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 folder.  The
16       .stignore  file  itself will never be synced to other devices, although
17       it can #include files that are synchronized between devices.  All  pat‐
18       terns  are  relative to the folder root.  The contents of the .stignore
19       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  folder  only.
63         /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 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.
86
87       NOTE:
88          Prefixes can be specified in any order (e.g. “(?d)(?i)”), but cannot
89          be in a single pair of parentheses (not “(?di)”).
90
91       NOTE:
92          Include patterns (that begin with !) cause Syncthing to traverse the
93          entire  directory  tree regardless of other ignore patterns.  If the
94          watcher is enabled, the entire directory tree  will  be  watched  as
95          well.
96
97          Top-level include patterns are treated as special cases and will not
98          force Syncthing to scan (or watch) the entire  directory  tree.  For
99          example:  !/foo  is  a top-level include pattern, while !/foo/bar is
100          not.
101

EXAMPLE

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

AUTHOR

158       The Syncthing Authors
159
161       2014-2019, The Syncthing Authors
162
163
164
165
166v1.20.0                          May 08, 2022            SYNCTHING-STIGNORE(5)
Impressum