From b3c1104760ba66cd07c8ba3ca5afb41cbe19b760 Mon Sep 17 00:00:00 2001 From: Saurav Sachidanand Date: Sat, 26 May 2018 21:13:43 +0530 Subject: [PATCH] Update docs on deleting multiple archives --- docs/usage/delete.rst | 9 +++++++++ src/borg/archiver.py | 13 ++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/docs/usage/delete.rst b/docs/usage/delete.rst index a50176811..bf3e2f54b 100644 --- a/docs/usage/delete.rst +++ b/docs/usage/delete.rst @@ -7,6 +7,15 @@ Examples # delete a single backup archive: $ borg delete /path/to/repo::Monday + # delete all archives whose names begin with the machine's hostname followed by "-" + $ borg delete --prefix '{hostname}-' /path/to/repo + + # delete all archives whose names contain "-2012-" + $ borg delete --glob-archives '*-2012-*' /path/to/repo + + # see what would be deleted if delete was run without --dry-run + $ borg delete -v --dry-run -a '*-May-*' /path/to/repo + # delete the whole repository and the related local cache: $ borg delete /path/to/repo You requested to completely DELETE the repository *including* all archives it contains: diff --git a/src/borg/archiver.py b/src/borg/archiver.py index 256b77d18..9da774380 100644 --- a/src/borg/archiver.py +++ b/src/borg/archiver.py @@ -3171,12 +3171,23 @@ class Archiver: delete_epilog = process_epilog(""" This command deletes an archive from the repository or the complete repository. Disk space is reclaimed accordingly. If you delete the complete repository, the - local cache for it (if any) is also deleted. + local cache for it (if any) is also deleted. Alternatively, you can delete just + the local cache with the ``--cache-only`` option. When using ``--stats``, you will get some statistics about how much data was deleted - the "Deleted data" deduplicated size there is most interesting as that is how much your repository will shrink. Please note that the "All archives" stats refer to the state after deletion. + + You can delete multiple archives by specifying their common prefix, if they + have one, using the ``--prefix PREFIX`` option. You can also specify a shell + pattern to match multiple archives using the ``--glob-archives GLOB`` option + (for more info on these patterns, see ``borg help patterns``). Note that these + two options are mutually exclusive. + + To avoid accidentally deleting archives, especially when using glob patterns, + it might be helpful to use the ``--dry-run`` to test out the command without + actually making any changes to the repository. """) subparser = subparsers.add_parser('delete', parents=[common_parser], add_help=False, description=self.do_delete.__doc__,