syncthing-stignore.5 8.6 KB

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