syncthing-stignore.5 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. .\" Man page generated from reStructuredText.
  2. .
  3. .TH "SYNCTHING-STIGNORE" "5" "Mar 01, 2021" "v1" "Syncthing"
  4. .SH NAME
  5. syncthing-stignore \- Prevent files from being synchronized to other nodes
  6. .
  7. .nr rst2man-indent-level 0
  8. .
  9. .de1 rstReportMargin
  10. \\$1 \\n[an-margin]
  11. level \\n[rst2man-indent-level]
  12. level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
  13. -
  14. \\n[rst2man-indent0]
  15. \\n[rst2man-indent1]
  16. \\n[rst2man-indent2]
  17. ..
  18. .de1 INDENT
  19. .\" .rstReportMargin pre:
  20. . RS \\$1
  21. . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
  22. . nr rst2man-indent-level +1
  23. .\" .rstReportMargin post:
  24. ..
  25. .de UNINDENT
  26. . RE
  27. .\" indent \\n[an-margin]
  28. .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
  29. .nr rst2man-indent-level -1
  30. .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
  31. .in \\n[rst2man-indent\\n[rst2man-indent-level]]u
  32. ..
  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
  48. \fB\&.stignore\fP file must be placed in the root of the folder. The
  49. \fB\&.stignore\fP file itself will never be synced to other devices, although it can
  50. \fB#include\fP files that \fIare\fP synchronized between devices. All patterns are
  51. relative to the folder root.
  52. The contents of the \fB\&.stignore\fP 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. \fIEscaped characters
  93. are not supported on Windows.\fP
  94. .IP \(bu 2
  95. A pattern beginning with \fB/\fP matches in the root of the folder only.
  96. \fB/foo\fP matches \fBfoo\fP but not \fBsubdir/foo\fP\&.
  97. .IP \(bu 2
  98. A pattern beginning with \fB#include\fP results in loading patterns
  99. from the named file. It is an error for a file to not exist or be
  100. included more than once. Note that while this can be used to include
  101. patterns from a file in a subdirectory, the patterns themselves are
  102. still relative to the folder \fIroot\fP\&. Example:
  103. \fB#include more\-patterns.txt\fP\&.
  104. .IP \(bu 2
  105. A pattern beginning with a \fB!\fP prefix negates the pattern: matching files
  106. are \fIincluded\fP (that is, \fInot\fP ignored). This can be used to override
  107. more general patterns that follow.
  108. .IP \(bu 2
  109. A pattern beginning with a \fB(?i)\fP prefix enables case\-insensitive pattern
  110. matching. \fB(?i)test\fP matches \fBtest\fP, \fBTEST\fP and \fBtEsT\fP\&. The
  111. \fB(?i)\fP prefix can be combined with other patterns, for example the
  112. pattern \fB(?i)!picture*.png\fP indicates that \fBPicture1.PNG\fP should
  113. be synchronized. On Mac OS and Windows, patterns are always case\-insensitive.
  114. .IP \(bu 2
  115. A pattern beginning with a \fB(?d)\fP prefix enables removal of these files if
  116. they are preventing directory deletion. This prefix should be used by any OS
  117. generated files which you are happy to be removed.
  118. .IP \(bu 2
  119. A line beginning with \fB//\fP is a comment and has no effect.
  120. .UNINDENT
  121. .sp
  122. \fBNOTE:\fP
  123. .INDENT 0.0
  124. .INDENT 3.5
  125. Prefixes can be specified in any order (e.g. “(?d)(?i)”), but cannot be in a
  126. single pair of parentheses (not “(?di)”).
  127. .UNINDENT
  128. .UNINDENT
  129. .sp
  130. \fBNOTE:\fP
  131. .INDENT 0.0
  132. .INDENT 3.5
  133. Include patterns (that begin with \fB!\fP) cause Syncthing to traverse and
  134. watch the entire directory tree regardless of other
  135. ignore patterns.
  136. .sp
  137. Top\-level include patterns are treated as special cases and will not force Syncthing to
  138. scan the entire directory tree. For example: \fB!/foo\fP is a top\-level include
  139. pattern, while \fB!/foo/bar\fP is not.
  140. .UNINDENT
  141. .UNINDENT
  142. .SH EXAMPLE
  143. .sp
  144. Given a directory layout:
  145. .INDENT 0.0
  146. .INDENT 3.5
  147. .sp
  148. .nf
  149. .ft C
  150. \&.DS_Store
  151. foo
  152. foofoo
  153. bar/
  154. baz
  155. quux
  156. quuz
  157. bar2/
  158. baz
  159. frobble
  160. My Pictures/
  161. Img15.PNG
  162. .ft P
  163. .fi
  164. .UNINDENT
  165. .UNINDENT
  166. .sp
  167. and an \fB\&.stignore\fP file with the contents:
  168. .INDENT 0.0
  169. .INDENT 3.5
  170. .sp
  171. .nf
  172. .ft C
  173. (?d).DS_Store
  174. !frobble
  175. !quuz
  176. foo
  177. *2
  178. qu*
  179. (?i)my pictures
  180. .ft P
  181. .fi
  182. .UNINDENT
  183. .UNINDENT
  184. .sp
  185. all files and directories called “foo”, ending in a “2” or starting with
  186. “qu” will be ignored. The end result becomes:
  187. .INDENT 0.0
  188. .INDENT 3.5
  189. .sp
  190. .nf
  191. .ft C
  192. \&.DS_Store # ignored, will be deleted if gets in the way of parent directory removal
  193. foo # ignored, matches "foo"
  194. foofoo # synced, does not match "foo" but would match "foo*" or "*foo"
  195. bar/ # synced
  196. baz # synced
  197. quux # ignored, matches "qu*"
  198. quuz # synced, matches "qu*" but is excluded by the preceding "!quuz"
  199. bar2/ # synced, despite matching "*2" due to child frobble
  200. baz # ignored, due to parent being ignored
  201. frobble # synced, due to "!frobble"
  202. My Pictures/ # ignored, matched case insensitive "(?i)my pictures" pattern
  203. Img15.PNG # ignored, due to parent being ignored
  204. .ft P
  205. .fi
  206. .UNINDENT
  207. .UNINDENT
  208. .sp
  209. \fBNOTE:\fP
  210. .INDENT 0.0
  211. .INDENT 3.5
  212. Please note that directory patterns ending with a slash
  213. \fBsome/directory/\fP matches the content of the directory, but not the
  214. directory itself. If you want the pattern to match the directory and its
  215. content, make sure it does not have a \fB/\fP at the end of the pattern.
  216. .UNINDENT
  217. .UNINDENT
  218. .SH AUTHOR
  219. The Syncthing Authors
  220. .SH COPYRIGHT
  221. 2014-2019, The Syncthing Authors
  222. .\" Generated by docutils manpage writer.
  223. .