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
15       ignore. The .stignore file must be placed in the root  of  the  folder.
16       The  .stignore  file  itself  will  never  be  synced to other devices,
17       although it can #include files that are synchronized  between  devices.
18       All  patterns  are  relative  to  the folder root.  The contents of the
19       .stignore file must be UTF-8 encoded.
20
21       NOTE:
22          Note that ignored files can block  removal  of  an  otherwise  empty
23          directory.   See  below  for  the  (?d)  prefix to allow deletion of
24          ignored 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.
33
34       · Asterisk  matches zero or more characters in a filename, but does not
35         match the directory separator. te*st  matches  test,  subdir/telerest
36         but not tele/rest.
37
38       · Double  asterisk  matches  as  above,  but also directory separators.
39         te**st matches test, subdir/telerest and tele/sub/dir/rest.
40
41       · Question mark matches a single character that is  not  the  directory
42         separator. te??st matches tebest but not teb/st or test.
43
44       · Characters  enclosed in square brackets [] are interpreted as a char‐
45         acter range [a-z]. Before using this syntax you should have  a  basic
46         understanding of regular expression character classes.
47
48       · A  pattern  beginning  with  / matches in the current directory only.
49         /foo matches foo but not subdir/foo.
50
51       · A pattern beginning with #include results in  loading  patterns  from
52         the named file. It is an error for a file to not exist or be included
53         more than once. Note that while this can be used to include  patterns
54         from a file in a subdirectory, the patterns themselves are still rel‐
55         ative to the folder root. Example: #include more-patterns.txt.
56
57       · A pattern beginning with a ! prefix  negates  the  pattern:  matching
58         files  are included (that is, not ignored). This can be used to over‐
59         ride more general patterns that follow.
60
61       · A pattern beginning with a (?i) prefix enables case-insensitive  pat‐
62         tern  matching. (?i)test matches test, TEST and tEsT. The (?i) prefix
63         can  be  combined  with  other  patterns,  for  example  the  pattern
64         (?i)!picture*.png indicates that Picture1.PNG should be synchronized.
65         On Mac OS and Windows, patterns are always case-insensitive.
66
67       · A pattern beginning with a (?d) prefix enables removal of these files
68         if they are preventing directory deletion. This prefix should be used
69         by any OS generated files which you are happy to be removed.
70
71       · A line beginning with // is a comment and has no effect.
72
73       · Windows does not support escaping \[foo - bar\].
74
75       NOTE:
76          Prefixes can be specified in any order (e.g. “(?d)(?i)”), but cannot
77          be in a single pair of parentheses (not “(?di)”).
78
79       NOTE:
80          Include patterns (that begin with !) cause Syncthing to traverse and
81          watch the entire directory tree regardless of other ignore patterns.
82

EXAMPLE

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

AUTHOR

132       The Syncthing Authors
133
135       2014-2019, The Syncthing Authors
136
137
138
139
140v1                               Mar 17, 2020            SYNCTHING-STIGNORE(5)
Impressum