help.rst.inc 1.5 KB

12345678910111213141516171819202122232425262728293031323334
  1. .. _borg_patterns:
  2. borg help patterns
  3. ~~~~~~~~~~~~~~~~~~
  4. ::
  5. Exclude patterns use a variant of shell pattern syntax, with '*' matching any
  6. number of characters, '?' matching any single character, '[...]' matching any
  7. single character specified, including ranges, and '[!...]' matching any
  8. character not specified. For the purpose of these patterns, the path
  9. separator ('\' for Windows and '/' on other systems) is not treated
  10. specially. For a path to match a pattern, it must completely match from
  11. start to end, or must match from the start to just before a path separator.
  12. Except for the root path, paths will never end in the path separator when
  13. matching is attempted. Thus, if a given pattern ends in a path separator, a
  14. '*' is appended before matching is attempted. Patterns with wildcards should
  15. be quoted to protect them from shell expansion.
  16. Examples:
  17. # Exclude '/home/user/file.o' but not '/home/user/file.odt':
  18. $ borg create -e '*.o' backup /
  19. # Exclude '/home/user/junk' and '/home/user/subdir/junk' but
  20. # not '/home/user/importantjunk' or '/etc/junk':
  21. $ borg create -e '/home/*/junk' backup /
  22. # Exclude the contents of '/home/user/cache' but not the directory itself:
  23. $ borg create -e /home/user/cache/ backup /
  24. # The file '/home/user/cache/important' is *not* backed up:
  25. $ borg create -e /home/user/cache/ backup / /home/user/cache/important