syncthing-stignore.5 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. .\" Man page generated from reStructuredText.
  2. .
  3. .
  4. .nr rst2man-indent-level 0
  5. .
  6. .de1 rstReportMargin
  7. \\$1 \\n[an-margin]
  8. level \\n[rst2man-indent-level]
  9. level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
  10. -
  11. \\n[rst2man-indent0]
  12. \\n[rst2man-indent1]
  13. \\n[rst2man-indent2]
  14. ..
  15. .de1 INDENT
  16. .\" .rstReportMargin pre:
  17. . RS \\$1
  18. . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
  19. . nr rst2man-indent-level +1
  20. .\" .rstReportMargin post:
  21. ..
  22. .de UNINDENT
  23. . RE
  24. .\" indent \\n[an-margin]
  25. .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
  26. .nr rst2man-indent-level -1
  27. .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
  28. .in \\n[rst2man-indent\\n[rst2man-indent-level]]u
  29. ..
  30. .TH "SYNCTHING-STIGNORE" "5" "Sep 06, 2025" "v2.0.0" "Syncthing"
  31. .SH NAME
  32. syncthing-stignore \- Prevent files from being synchronized to other nodes
  33. .SH SYNOPSIS
  34. .INDENT 0.0
  35. .INDENT 3.5
  36. .sp
  37. .EX
  38. \&.stignore
  39. .EE
  40. .UNINDENT
  41. .UNINDENT
  42. .SH DESCRIPTION
  43. .sp
  44. If some files should not be synchronized to (or from) other devices, a file called
  45. \fB\&.stignore\fP can be created containing file patterns to ignore. The \fB\&.stignore\fP
  46. file must be placed in the root of the synced folder (files in other locations are
  47. not applied). The \fB\&.stignore\fP file itself will never be synced to other devices,
  48. although it can \fB#include\fP files that \fIare\fP synchronized between devices. All
  49. patterns are relative to the synced folder root. The contents of the \fB\&.stignore\fP
  50. file must be UTF\-8 encoded.
  51. .sp
  52. \fBNOTE:\fP
  53. .INDENT 0.0
  54. .INDENT 3.5
  55. Note that ignored files can block removal of an otherwise empty directory.
  56. See below for the (?d) prefix to allow deletion of ignored files.
  57. .UNINDENT
  58. .UNINDENT
  59. .SH PATTERNS
  60. .sp
  61. The \fB\&.stignore\fP file contains a list of file or path patterns. The
  62. \fIfirst\fP pattern that matches will decide the fate of a given file.
  63. .INDENT 0.0
  64. .IP \(bu 2
  65. Regular file names match themselves, i.e. the pattern \fBfoo\fP matches
  66. the files \fBfoo\fP, \fBsubdir/foo\fP as well as any directory named
  67. \fBfoo\fP\&. Spaces are treated as regular characters, except for leading
  68. and trailing spaces, which are automatically trimmed.
  69. .IP \(bu 2
  70. \fBAsterisk\fP (\fB*\fP) matches zero or more characters in a filename, but does not
  71. match the directory separator. \fBte*ne\fP matches \fBtelephone\fP,
  72. \fBsubdir/telephone\fP but not \fBtele/phone\fP\&.
  73. .IP \(bu 2
  74. \fBDouble asterisk\fP (\fB**\fP) matches as above, but also directory separators.
  75. \fBte**ne\fP matches \fBtelephone\fP, \fBsubdir/telephone\fP and
  76. \fBtele/sub/dir/phone\fP\&.
  77. .IP \(bu 2
  78. \fBQuestion mark\fP (\fB?\fP) matches a single character that is not the directory
  79. separator. \fBte??st\fP matches \fBtebest\fP but not \fBteb/st\fP or
  80. \fBtest\fP\&.
  81. .IP \(bu 2
  82. \fBSquare brackets\fP (\fB[]\fP) denote a character range: \fB[a\-z]\fP matches
  83. any lower case character.
  84. .IP \(bu 2
  85. \fBCurly brackets\fP (\fB{}\fP) denote a set of comma separated alternatives:
  86. \fB{banana,pineapple}\fP matches either \fBbanana\fP or \fBpineapple\fP\&.
  87. .IP \(bu 2
  88. \fBBackslash\fP (\fB\e\fP) “escapes” a special character so that it loses its
  89. special meaning. For example, \fB\e{banana\e}\fP matches \fB{banana}\fP exactly
  90. and does not denote a set of alternatives as above.
  91. .sp
  92. \fBNOTE:\fP
  93. .INDENT 2.0
  94. .INDENT 3.5
  95. On Windows, \fB\e\fP is the path separator, so use \fB|\fP to escape special
  96. characters. For example, \fB|{banana|}\fP matches
  97. \fB{banana}\fP\&.
  98. .sp
  99. To use \fB\e\fP to escape special characters (and use \fB/\fP as the path separator),
  100. insert a \fB#escape=\e\fP at the top of the file. Here’s a short example:
  101. .INDENT 0.0
  102. .INDENT 3.5
  103. .nf
  104. \fB#escape=\e\fP
  105. \fB/foo\fP
  106. \fB/path/bar/\e{banana\e}\fP
  107. \fB/path/baz\e[2\e]/ex\e[3\e].txt\fP
  108. .fi
  109. .sp
  110. .UNINDENT
  111. .UNINDENT
  112. .sp
  113. \fB#escape=\e\fP must be placed at the top of the file, before any patterns,
  114. but leading comments, and blank lines are OK.
  115. .sp
  116. Any files included using \fB#include\fP (see below) will each need their
  117. own \fB#escape=\e\fP\&.
  118. .sp
  119. Using \fB#escape=\e\fP allows the same file to be synced and used on any
  120. operating system.
  121. .UNINDENT
  122. .UNINDENT
  123. .IP \(bu 2
  124. A pattern beginning with \fB/\fP matches in the root of the synced folder only.
  125. \fB/foo\fP matches \fBfoo\fP but not \fBsubdir/foo\fP\&.
  126. .IP \(bu 2
  127. A pattern beginning with \fB#include\fP results in loading patterns
  128. from the named file. It is an error for a file to not exist or be
  129. included more than once. Note that while this can be used to include
  130. patterns from a file in a subdirectory, the patterns themselves are
  131. still relative to the synced folder \fIroot\fP\&. Example:
  132. \fB#include more\-patterns.txt\fP\&.
  133. .sp
  134. Any \fB#include\fP directives inside a file loaded by \fB#include\fP require paths
  135. specified relative to the directory containing the loaded file, rather than the
  136. synchronised root directory.
  137. .IP \(bu 2
  138. A pattern beginning with a \fB!\fP prefix negates the pattern: matching files
  139. are \fIincluded\fP (that is, \fInot\fP ignored). This can be used to override
  140. more general patterns that follow.
  141. .sp
  142. \fBNOTE:\fP
  143. .INDENT 2.0
  144. .INDENT 3.5
  145. Negated patterns that can match items below the folder root will cause
  146. Syncthing to traverse otherwise ignored directories. If the
  147. \fI\%watcher\fP is enabled, those directories will also be
  148. watched. Directories ignored before the first negated pattern can
  149. however be safely skipped, since the first matching pattern wins. For
  150. example:
  151. .INDENT 0.0
  152. .INDENT 3.5
  153. .sp
  154. .EX
  155. /foo
  156. /bar
  157. !baz
  158. *
  159. .EE
  160. .UNINDENT
  161. .UNINDENT
  162. .sp
  163. The directories \fBfoo\fP and \fBbar\fP will be entirely ignored. However any
  164. other directories present must be scanned entirely to find any items
  165. named \fIbaz\fP, despite the fact that they will be ignored due to the
  166. \fB*\fP\&. As a special case, top\-level rooted patterns (e.g. \fB!/foo\fP) do
  167. not cause this behaviour:
  168. .INDENT 0.0
  169. .INDENT 3.5
  170. .sp
  171. .EX
  172. !/baz
  173. *
  174. .EE
  175. .UNINDENT
  176. .UNINDENT
  177. .sp
  178. In this case, only the directory \fBbaz\fP will be scanned, since
  179. everything else is ignored by the \fB*\fP pattern.
  180. .UNINDENT
  181. .UNINDENT
  182. .IP \(bu 2
  183. A pattern beginning with a \fB(?i)\fP prefix enables case\-insensitive pattern
  184. matching. \fB(?i)test\fP matches \fBtest\fP, \fBTEST\fP and \fBtEsT\fP\&. The
  185. \fB(?i)\fP prefix can be combined with other patterns, for example the
  186. pattern \fB(?i)!picture*.png\fP indicates that \fBPicture1.PNG\fP should
  187. be synchronized. On Mac OS and Windows, patterns are always case\-insensitive.
  188. .IP \(bu 2
  189. A pattern beginning with a \fB(?d)\fP prefix enables removal of these files if
  190. they are preventing directory deletion. This prefix should be used by any OS
  191. generated files which you are happy to be removed.
  192. .sp
  193. \fBNOTE:\fP
  194. .INDENT 2.0
  195. .INDENT 3.5
  196. Prefixes can be specified in any order (e.g. \fB(?d)(?i)\fP), but cannot
  197. be combined in a single pair of parentheses like (?di)\&.
  198. .UNINDENT
  199. .UNINDENT
  200. .IP \(bu 2
  201. A line beginning with \fB//\fP is a comment and has no effect. The same double
  202. slashes in any other place are interpreted literally, e.g. trying to do
  203. \fBfile // comment\fP will make Syncthing look for a file called \fBfile // comment\fP\&.
  204. .UNINDENT
  205. .SH EXAMPLE
  206. .sp
  207. Given a directory layout starting at the synced folder’s root:
  208. .INDENT 0.0
  209. .INDENT 3.5
  210. .sp
  211. .EX
  212. \&.DS_Store
  213. \&.stignore
  214. foo
  215. foofoo
  216. bar/
  217. baz
  218. quux
  219. quuz
  220. bar2/
  221. baz
  222. frobble
  223. My Pictures/
  224. Img15.PNG
  225. .EE
  226. .UNINDENT
  227. .UNINDENT
  228. .sp
  229. and an \fB\&.stignore\fP file with the contents:
  230. .INDENT 0.0
  231. .INDENT 3.5
  232. .sp
  233. .EX
  234. (?d).DS_Store
  235. !frobble
  236. !quuz
  237. foo
  238. *2
  239. qu*
  240. (?i)my pictures
  241. .EE
  242. .UNINDENT
  243. .UNINDENT
  244. .sp
  245. all files and directories called “foo”, ending in a “2” or starting with
  246. “qu” will be ignored. The end result becomes:
  247. .INDENT 0.0
  248. .INDENT 3.5
  249. .sp
  250. .EX
  251. \&.DS_Store # ignored, will be deleted if gets in the way of parent directory removal
  252. foo # ignored, matches \(dqfoo\(dq
  253. foofoo # synced, does not match \(dqfoo\(dq but would match \(dqfoo*\(dq or \(dq*foo\(dq
  254. bar/ # synced
  255. baz # synced
  256. quux # ignored, matches \(dqqu*\(dq
  257. quuz # synced, matches \(dqqu*\(dq but is excluded by the preceding \(dq!quuz\(dq
  258. bar2/ # synced, despite matching \(dq*2\(dq due to child frobble
  259. baz # ignored, due to parent being ignored
  260. frobble # synced, due to \(dq!frobble\(dq
  261. My Pictures/ # ignored, matched case insensitive \(dq(?i)my pictures\(dq pattern
  262. Img15.PNG # ignored, due to parent being ignored
  263. .EE
  264. .UNINDENT
  265. .UNINDENT
  266. .sp
  267. \fBNOTE:\fP
  268. .INDENT 0.0
  269. .INDENT 3.5
  270. Please note that directory patterns ending with a slash
  271. \fBsome/directory/\fP matches the content of the directory, but not the
  272. directory itself. If you want the pattern to match the directory and its
  273. content, make sure it does not have a \fB/\fP at the end of the pattern.
  274. .UNINDENT
  275. .UNINDENT
  276. .sp
  277. Added in version 1.19.0: Default patterns can be configured which will take effect when automatically
  278. accepting a folder from a remote device. The GUI suggests the same patterns
  279. when adding a folder manually. In either case, the \fB\&.stignore\fP file is
  280. created with these defaults if none is present yet.
  281. .sp
  282. Added in version 2.0.0: Windows users can now use the pipe character (\fB|\fP) to escape
  283. metacharacters in the \fB\&.stignore\fP file. Additionally, adding
  284. \fB#escape=X\fP to the top of the file, allows users to define \fBX\fP
  285. as the escape character for that particular file.
  286. .SH AUTHOR
  287. The Syncthing Authors
  288. .SH COPYRIGHT
  289. 2014-2025, The Syncthing Authors
  290. .\" Generated by docutils manpage writer.
  291. .