borg-match-archives(1)
β¨ Name β¨
borg-match-archives β the whole tea on matching archives π«π
πΈ DESCRIPTION πΈ
okay so bestie, the --match-archives option takes a pattern and matches it against the list of all the archives in the repository. The way that you can drop it multiple times?? iconic. And important: an archive is only considered if it matches all the patterns you gave. every single one. no skipping π
Some commands also let you hand over an archive NAME as a positional argument β and that NAME gets treated like just another pattern. So NAME and --match-archives can be combined to narrow down the selection, like:
borg prune home -a host:myhost
NAME accepts the exact same prefixes as the patterns below, fr fr, e.g. borg info aid:1234abcd.
π The prefixes π
The patterns can have a prefix of:
name:β pattern match on the archive name (this is the default, no cap)aid:β prefix match on the archive id (only one result allowed, so don't get greedy π)user:β exact match on the username who created the archivehost:β exact match on the hostname where the archive was createdtags:β match archives having all the given tags (comma-separated, e.g.tags:TAG1,TAG2)date:β match on the archive creation timestamp
π« Pattern styles (for name pattern matches) π«
When it's a name pattern match, it uses pattern styles similar to the ones described by borg help patterns:
- Identical match pattern, selector
id:(default) β simple string match, must fully match exactly as given. no wiggle room, periodt. - Shell-style patterns, selector
sh:β match like on the shell, wildcards like*and?work β¨ - Regular expressions <https://docs.python.org/3/library/re.html>, selector
re:β full regular expression support. This is very powerful, but can also get rather complicated. main character energy but she's a lot π
π¦ Date patterns, selector date: π¦
Match archives by creation timestamp. You can either match a single archive by passing its exact creation time, or all archives created within a given time interval.
To match a single archive by its exact creation time, use the forms:
YYYY-MM-DDTHH:MM:SS.ffffff: ISO-8601-like date-time string@1735732800.123456: UNIX timestamp
To match a single archive, the pattern must specify the archive's complete creation timestamp, including any fractional seconds. Fractional-second patterns accept 1 to 6 digits π’
To match all archives created within a given time interval, use the forms:
YYYY: match all archives created within the given yearYYYY-MM: within the given monthYYYY-MM-DD: on the given dayYYYY-MM-DDTHH: in the given hourYYYY-MM-DDTHH:MM: in the given minuteYYYY-MM-DDTHH:MM:SS: in the given second@1735732800: within the 1 second interval from the given UNIX timestamp
The T date-time separator may also be written as a space, e.g. date:2025-01-01 14:30.
Date and time patterns match the interval implied by their precision, including the start and excluding the end. For example, date:2026-06 matches archives created on or after 2026-06-01T00:00:00 and before 2026-07-01T00:00:00.
Date and time patterns may include a timezone suffix: Z (UTC), +HH:MM, -HH:MM, or [Region/City]. Patterns without a timezone are interpreted in the local timezone. Unix timestamps are always UTC and do not accept a timezone suffix. noted π
β οΈ bestie pls be wary of Daylight Saving Time (DST) transitions, because they can make time intervals ambiguous or nonexistent π For example, named zones such as[Europe/Berlin]track DST, but the equivalent (winter) UTC offset of+01:00does not. Use UTC to avoid such issues. this is the vibe check you did NOT want to fail π
π Examples π
# name match, id: style
borg delete --match-archives 'id:archive-with-crap'
borg delete -a 'id:archive-with-crap' # same, using short option
borg delete -a 'archive-with-crap' # same, because 'id:' is the default
# name match, sh: style
borg delete -a 'sh:home-kenny-*'
# name match, re: style
borg delete -a 're:pc[123]-home-(user1|user2)-2022-09-.*'
# archive id prefix match:
borg delete -a 'aid:d34db33f'
# host or user match
borg delete -a 'user:kenny'
borg delete -a 'host:kenny-pc'
# tags match (both lines match archives having TAG1 and TAG2)
borg delete -a 'tags:TAG1' -a 'tags:TAG2'
borg delete -a 'tags:TAG1,TAG2'
# archive creation date match
borg delete -a 'date:2025-01'
borg delete -a 'date:2025-01-01T14:30Z'
borg delete -a 'date:2025-01-01T09:30[America/New_York]'
ate, literally every one of those π₯
π Author π
The Borg Collective β the og squad π«Ά
okay that's the whole page bestie, you're soooo ready for your backups now πβ¨ this was borg-match-archives(1) from the borg backup tool, dated 2026-10-07 β go forth and match some archives, you absolute icon ππΈ
π¦ where this page comes from
- ubuntu stonking: borgbackup2 2.0.0b25-4 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms