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         Any  #include  directives  inside  a  file loaded by #include require
72         paths specified relative to the directory containing the loaded file,
73         rather than the synchronised root directory.
74
75       • A  pattern  beginning  with  a ! prefix negates the pattern: matching
76         files are included (that is, not ignored). This can be used to  over‐
77         ride more general patterns that follow.
78
79       • A  pattern beginning with a (?i) prefix enables case-insensitive pat‐
80         tern matching. (?i)test matches test, TEST and tEsT. The (?i)  prefix
81         can  be  combined  with  other  patterns,  for  example  the  pattern
82         (?i)!picture*.png indicates that Picture1.PNG should be synchronized.
83         On Mac OS and Windows, patterns are always case-insensitive.
84
85       • A pattern beginning with a (?d) prefix enables removal of these files
86         if they are preventing directory deletion. This prefix should be used
87         by any OS generated files which you are happy to be removed.
88
89       • A  line  beginning  with  // is a comment and has no effect. The same
90         double slashes in any other place  are  interpreted  literally,  e.g.
91         trying  to  do  file  //  comment will make Syncthing look for a file
92         called file // comment.
93
94       NOTE:
95          Prefixes can be specified in any order (e.g. “(?d)(?i)”), but cannot
96          be in a single pair of parentheses (not “(?di)”).
97
98       NOTE:
99          Include patterns (that begin with !) cause Syncthing to traverse the
100          entire directory tree regardless of other ignore patterns.   If  the
101          watcher  is  enabled,  the  entire directory tree will be watched as
102          well.
103
104          Top-level include patterns are treated as special cases and will not
105          force  Syncthing  to  scan (or watch) the entire directory tree. For
106          example: !/foo is a top-level include pattern,  while  !/foo/bar  is
107          not.
108

EXAMPLE

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

AUTHOR

166       The Syncthing Authors
167
169       2014-2019, The Syncthing Authors
170
171
172
173
174v1.25.0                          Oct 05, 2023            SYNCTHING-STIGNORE(5)
Impressum