bup-prune-older(1)

โœจ NAME โœจ

bup-prune-older โ€” bestie, this is the one that removes older saves ๐Ÿ’…


๐ŸŒธ SYNOPSIS ๐ŸŒธ

bup prune-older [options...]  <branch...>

Note the bup-prune-older(1) manual page vibe โ€” what you actually type is bup prune-older, and then a bunch of options, and then one or more branch names. ๐Ÿซถ


๐ŸŽ€ DESCRIPTION ๐ŸŽ€

okay so here's the deal: bup prune-older removes โ€” and we mean permanently deletes โ€” every single save except the ones preserved by the various keep arguments down below. You must specify at least one keep argument, like, it's not optional, no cap. This command is basically equivalent to running a suitable bup rm invocation and then following it up with bup gc. Two steps, one glow-up. โœจ

Heads up bestie: the current implementation expects a typical branch where a new save's date is always the same as or newer than the previous one. When that's not the case, only the saves at the end of the branch that have non-increasing timestamps (child to parent) will be affected by this command. Future versions are likely to lift this restriction.
โš ๏ธ WARNING: This is one of the few bup commands that modifies your archive in intentionally destructive ways. ๐Ÿ˜ญ Like, for real, it's giving "no take-backs." Though if an attempt to join or restore the data you still care about after a prune-older succeeds, that's a fairly encouraging sign that the commands worked correctly. (The dev/compare-trees command in the source tree can be used to help test before/after results.) ๐Ÿ™ˆ

๐Ÿฆ‹ KEEP PERIODS ๐Ÿฆ‹

A --keep PERIOD (as required below) must be an integer followed by a scale, or "forever". For example, 12y specifies a PERIOD of twelve years. Here are the valid scales, and yes, you need to memorize these, iykyk:

  • s indicates seconds
  • min indicates minutes (60s)
  • h indicates hours (60m)
  • d indicates days (24h)
  • w indicates weeks (7d)
  • m indicates months (31d)
  • y indicates years (366d)
  • forever is infinitely far in the past

As indicated, the PERIODS are computed with respect to the current time, or the --wrt value if specified, and they do not respect any calendar. So --keep-dailies-for 5d means a period starting exactly 5 * 24 * 60 * 60 seconds before the starting point. Math, but make it archive maintenance. ๐Ÿงฎ๐Ÿ’–


๐Ÿ‘‘ OPTIONS ๐Ÿ‘‘

  • --keep-all-for PERIOD โ€” when no smaller time scale --keep option applies, retain all saves within the given period. Everything. All of it. Keeping it. ๐Ÿซถ
  • --keep-dailies-for PERIOD โ€” when no smaller time scale --keep option applies, retain the newest save for any day within the given period. One save per day, main character of that day only. ๐Ÿ‘‘
  • --keep-monthlies-for PERIOD โ€” when no smaller time scale --keep option applies, retain the newest save for any month within the given period.
  • --keep-yearlies-for PERIOD โ€” when no smaller time scale --keep option applies, retain the newest save for any year within the given period.
  • --wrt UTC_SECONDS โ€” when computing a keep period, place the most recent end of the range at UTC_SECONDS, and any saves newer than this will be kept. Setting the timeline's mood, fr. โฐ
  • --pretend โ€” don't do anything, just list the actions that would be taken to standard output, one action per line like this:
- SAVE
+ SAVE
...
  • --gc โ€” garbage collect the repository after removing the relevant saves. This is the default behavior, but it can be avoided with --no-gc. ๐Ÿ—‘๏ธโœจ
  • --gc-threshold N โ€” only rewrite a packfile if it's over N percent garbage; otherwise leave it alone. The default threshold is 10%. Like, if it's not messy enough, we simply do not perceive it. ๐Ÿ’…
  • -#, --compress # โ€” set the compression level when rewriting archive data to # (a value from 0-9, where 9 is the highest and 0 is no compression). The default is 1 (fast, loose compression).
  • -v, --verbose โ€” increase verbosity (can be specified more than once). Say it louder for the people in the back. ๐Ÿ“ฃ

๐Ÿ’œ NOTES ๐Ÿ’œ

When --verbose is specified, the save periods will be summarized to standard error with lines like this:

keeping monthlies since 1969-07-20-201800
keeping all yearlies
...

It's possible that the current implementation might not be able to format the date if, for example, it is far enough back in time. In that case, you will see something like this:

keeping yearlies since -30109891477 seconds before 1969-12-31-180000
...

Like, the date formatting just gives up and hands you a raw negative-second countdown. Not me crying over epoch math. ๐Ÿ˜ญ


๐Ÿ’– EXAMPLES ๐Ÿ’–

# Keep all saves for the past month, and any newer monthlies for
# the past year.  Delete everything else.
$ bup prune-older --keep-all-for 1m --keep-monthlies-for 1y

# Keep all saves for the past 6 months and delete everything else,
# but only on the semester branch.
$ bup prune-older --keep-all-for 6m semester

See how she eats? ๐Ÿ”ฅ


๐ŸŒˆ SEE ALSO ๐ŸŒˆ

bup-rm(1), bup-gc(1), and bup-fsck(1) โ€” the whole friend group, literally.


๐Ÿ’ซ BUP ๐Ÿ’ซ

Part of the bup(1) suite. One big happy family. ๐Ÿซถ


๐ŸŽ€ AUTHORS ๐ŸŽ€

Rob Browning rlb@defaultvalue.org


that's the whole page bestie, brought to you by bup 0.34, dated 2026-09-01 โ€” go forth and prune responsibly, and remember: --pretend first, always. ๐Ÿ’…โœจ๐Ÿ’–

๐Ÿ“ฆ where this page comes from