syncthing-stignore.5 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  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" "Jun 02, 2024" "v1.27.7" "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. Escaped characters are not supported on Windows, where \fB\e\fP is the
  96. path separator. If you still need to match files that have square or
  97. curly brackets in their names, one possible workaround is to replace
  98. them with \fB?\fP, which will then match any character. For example,
  99. you can type \fB?banana?\fP to match both \fB[banana]\fP and
  100. \fB{banana}\fP, and so on.
  101. .UNINDENT
  102. .UNINDENT
  103. .IP \(bu 2
  104. A pattern beginning with \fB/\fP matches in the root of the synced folder only.
  105. \fB/foo\fP matches \fBfoo\fP but not \fBsubdir/foo\fP\&.
  106. .IP \(bu 2
  107. A pattern beginning with \fB#include\fP results in loading patterns
  108. from the named file. It is an error for a file to not exist or be
  109. included more than once. Note that while this can be used to include
  110. patterns from a file in a subdirectory, the patterns themselves are
  111. still relative to the synced folder \fIroot\fP\&. Example:
  112. \fB#include more\-patterns.txt\fP\&.
  113. .sp
  114. Any \fB#include\fP directives inside a file loaded by \fB#include\fP require paths
  115. specified relative to the directory containing the loaded file, rather than the
  116. synchronised root directory.
  117. .IP \(bu 2
  118. A pattern beginning with a \fB!\fP prefix negates the pattern: matching files
  119. are \fIincluded\fP (that is, \fInot\fP ignored). This can be used to override
  120. more general patterns that follow.
  121. .sp
  122. \fBNOTE:\fP
  123. .INDENT 2.0
  124. .INDENT 3.5
  125. Negated patterns that can match items below the folder root will cause
  126. Syncthing to traverse otherwise ignored directories. If the
  127. \X'tty: link #scanning'\fI\%watcher\fP\X'tty: link' is enabled, those directories will also be
  128. watched. Directories ignored before the first negated pattern can
  129. however be safely skipped, since the first matching pattern wins. For
  130. example:
  131. .INDENT 0.0
  132. .INDENT 3.5
  133. .sp
  134. .EX
  135. /foo
  136. /bar
  137. !baz
  138. *
  139. .EE
  140. .UNINDENT
  141. .UNINDENT
  142. .sp
  143. The directories \fBfoo\fP and \fBbar\fP will be entirely ignored. However any
  144. other directories present must be scanned entirely to find any items
  145. named \fIbaz\fP, despite the fact that they will be ignored due to the
  146. \fB*\fP\&. As a special case, top\-level rooted patterns (e.g. \fB!/foo\fP) do
  147. not cause this behaviour:
  148. .INDENT 0.0
  149. .INDENT 3.5
  150. .sp
  151. .EX
  152. !/baz
  153. *
  154. .EE
  155. .UNINDENT
  156. .UNINDENT
  157. .sp
  158. In this case, only the directory \fBbaz\fP will be scanned, since
  159. everything else is ignored by the \fB*\fP pattern.
  160. .UNINDENT
  161. .UNINDENT
  162. .IP \(bu 2
  163. A pattern beginning with a \fB(?i)\fP prefix enables case\-insensitive pattern
  164. matching. \fB(?i)test\fP matches \fBtest\fP, \fBTEST\fP and \fBtEsT\fP\&. The
  165. \fB(?i)\fP prefix can be combined with other patterns, for example the
  166. pattern \fB(?i)!picture*.png\fP indicates that \fBPicture1.PNG\fP should
  167. be synchronized. On Mac OS and Windows, patterns are always case\-insensitive.
  168. .IP \(bu 2
  169. A pattern beginning with a \fB(?d)\fP prefix enables removal of these files if
  170. they are preventing directory deletion. This prefix should be used by any OS
  171. generated files which you are happy to be removed.
  172. .sp
  173. \fBNOTE:\fP
  174. .INDENT 2.0
  175. .INDENT 3.5
  176. Prefixes can be specified in any order (e.g. \fB(?d)(?i)\fP), but cannot
  177. be combined in a single pair of parentheses like (?di)\&.
  178. .UNINDENT
  179. .UNINDENT
  180. .IP \(bu 2
  181. A line beginning with \fB//\fP is a comment and has no effect. The same double
  182. slashes in any other place are interpreted literally, e.g. trying to do
  183. \fBfile // comment\fP will make Syncthing look for a file called \fBfile // comment\fP\&.
  184. .UNINDENT
  185. .SH EXAMPLE
  186. .sp
  187. Given a directory layout starting at the synced folder’s root:
  188. .INDENT 0.0
  189. .INDENT 3.5
  190. .sp
  191. .EX
  192. \&.DS_Store
  193. \&.stignore
  194. foo
  195. foofoo
  196. bar/
  197. baz
  198. quux
  199. quuz
  200. bar2/
  201. baz
  202. frobble
  203. My Pictures/
  204. Img15.PNG
  205. .EE
  206. .UNINDENT
  207. .UNINDENT
  208. .sp
  209. and an \fB\&.stignore\fP file with the contents:
  210. .INDENT 0.0
  211. .INDENT 3.5
  212. .sp
  213. .EX
  214. (?d).DS_Store
  215. !frobble
  216. !quuz
  217. foo
  218. *2
  219. qu*
  220. (?i)my pictures
  221. .EE
  222. .UNINDENT
  223. .UNINDENT
  224. .sp
  225. all files and directories called “foo”, ending in a “2” or starting with
  226. “qu” will be ignored. The end result becomes:
  227. .INDENT 0.0
  228. .INDENT 3.5
  229. .sp
  230. .EX
  231. \&.DS_Store # ignored, will be deleted if gets in the way of parent directory removal
  232. foo # ignored, matches \(dqfoo\(dq
  233. foofoo # synced, does not match \(dqfoo\(dq but would match \(dqfoo*\(dq or \(dq*foo\(dq
  234. bar/ # synced
  235. baz # synced
  236. quux # ignored, matches \(dqqu*\(dq
  237. quuz # synced, matches \(dqqu*\(dq but is excluded by the preceding \(dq!quuz\(dq
  238. bar2/ # synced, despite matching \(dq*2\(dq due to child frobble
  239. baz # ignored, due to parent being ignored
  240. frobble # synced, due to \(dq!frobble\(dq
  241. My Pictures/ # ignored, matched case insensitive \(dq(?i)my pictures\(dq pattern
  242. Img15.PNG # ignored, due to parent being ignored
  243. .EE
  244. .UNINDENT
  245. .UNINDENT
  246. .sp
  247. \fBNOTE:\fP
  248. .INDENT 0.0
  249. .INDENT 3.5
  250. Please note that directory patterns ending with a slash
  251. \fBsome/directory/\fP matches the content of the directory, but not the
  252. directory itself. If you want the pattern to match the directory and its
  253. content, make sure it does not have a \fB/\fP at the end of the pattern.
  254. .UNINDENT
  255. .UNINDENT
  256. .sp
  257. Added in version 1.19.0: Default patterns can be configured which will take effect when automatically
  258. accepting a folder from a remote device. The GUI suggests same the patterns
  259. when adding a folder manually. In either case, the \fB\&.stignore\fP file is
  260. created with these defaults if none is present yet.
  261. .SH AUTHOR
  262. The Syncthing Authors
  263. .SH COPYRIGHT
  264. 2014-2019, The Syncthing Authors
  265. .\" Generated by docutils manpage writer.
  266. .