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