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.  Escaped  characters
54         are not supported on Windows.
55
56       • A  pattern  beginning  with / matches in the root of the folder only.
57         /foo matches foo but not subdir/foo.
58
59       • A pattern beginning with #include results in  loading  patterns  from
60         the named file. It is an error for a file to not exist or be included
61         more than once. Note that while this can be used to include  patterns
62         from a file in a subdirectory, the patterns themselves are still rel‐
63         ative to the folder root. Example: #include more-patterns.txt.
64
65       • A pattern beginning with a ! prefix  negates  the  pattern:  matching
66         files  are included (that is, not ignored). This can be used to over‐
67         ride more general patterns that follow.
68
69       • A pattern beginning with a (?i) prefix enables case-insensitive  pat‐
70         tern  matching. (?i)test matches test, TEST and tEsT. The (?i) prefix
71         can  be  combined  with  other  patterns,  for  example  the  pattern
72         (?i)!picture*.png indicates that Picture1.PNG should be synchronized.
73         On Mac OS and Windows, patterns are always case-insensitive.
74
75       • A pattern beginning with a (?d) prefix enables removal of these files
76         if they are preventing directory deletion. This prefix should be used
77         by any OS generated files which you are happy to be removed.
78
79       • A line beginning with // is a comment and has no effect.
80
81       NOTE:
82          Prefixes can be specified in any order (e.g. “(?d)(?i)”), but cannot
83          be in a single pair of parentheses (not “(?di)”).
84
85       NOTE:
86          Include patterns (that begin with !) cause Syncthing to traverse and
87          watch the entire directory tree regardless of other ignore patterns.
88
89          Top-level include patterns are treated as special cases and will not
90          force  Syncthing  to  scan  the  entire directory tree. For example:
91          !/foo is a top-level include pattern, while !/foo/bar is not.
92

EXAMPLE

94       Given a directory layout:
95
96          .DS_Store
97          foo
98          foofoo
99          bar/
100              baz
101              quux
102              quuz
103          bar2/
104              baz
105              frobble
106          My Pictures/
107              Img15.PNG
108
109       and an .stignore file with the contents:
110
111          (?d).DS_Store
112          !frobble
113          !quuz
114          foo
115          *2
116          qu*
117          (?i)my pictures
118
119       all files and directories called “foo”, ending in  a  “2”  or  starting
120       with “qu” will be ignored. The end result becomes:
121
122          .DS_Store     # ignored, will be deleted if gets in the way of parent directory removal
123          foo           # ignored, matches "foo"
124          foofoo        # synced, does not match "foo" but would match "foo*" or "*foo"
125          bar/          # synced
126              baz       # synced
127              quux      # ignored, matches "qu*"
128              quuz      # synced, matches "qu*" but is excluded by the preceding "!quuz"
129          bar2/         # synced, despite matching "*2" due to child frobble
130              baz       # ignored, due to parent being ignored
131              frobble   # synced, due to "!frobble"
132          My Pictures/  # ignored, matched case insensitive "(?i)my pictures" pattern
133              Img15.PNG # ignored, due to parent being ignored
134
135       NOTE:
136          Please  note that directory patterns ending with a slash some/direc‐
137          tory/ matches the content of the directory, but  not  the  directory
138          itself.  If you want the pattern to match the directory and its con‐
139          tent, make sure it does not have a / at the end of the pattern.
140

AUTHOR

142       The Syncthing Authors
143
145       2014-2019, The Syncthing Authors
146
147
148
149
150v1                               Apr 15, 2021            SYNCTHING-STIGNORE(5)
Impressum