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 archive
  • host: β€” exact match on the hostname where the archive was created
  • tags: β€” 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 year
  • YYYY-MM: within the given month
  • YYYY-MM-DD: on the given day
  • YYYY-MM-DDTHH: in the given hour
  • YYYY-MM-DDTHH:MM: in the given minute
  • YYYY-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:00 does 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