From 0a6818cd7a55b2b2c1a5255effe15dca32b560b7 Mon Sep 17 00:00:00 2001 From: Winfried Plappert Date: Wed, 19 Feb 2025 07:37:16 +0000 Subject: [PATCH] rewrite documentation - explain handling of empty subdirectories Added a paragraph about the handling of empty subdirectories for the `--include` variants. --- doc/045_working_with_repos.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/doc/045_working_with_repos.rst b/doc/045_working_with_repos.rst index d5f2240b8..80ee82c6b 100644 --- a/doc/045_working_with_repos.rst +++ b/doc/045_working_with_repos.rst @@ -329,6 +329,19 @@ The options ``--exclude``, ``--exclude-file``, ``--iexclude`` and ``--iexclude-file`` are supported. They behave the same way as for the backup command, see :ref:`backup-excluding-files` for details. +The options ``--include``, ``--include-file``, ``--iinclude`` and +``--iinclude-file`` are supported as well. +The ``--include`` variants allow you to reduce an exsiting snapshot or a set of snapshots +to those files which your are really interested in. An example could be all pictures +files from a snapshot: +``restic rewrite -r ... --iinclude "*.jpg" --iinclude "*.jpeg" --iinclude "*.png"``. + +Empty subdirectories however will always be preserved. +Totally empty subdirectories (apart from genuine ones) +which have been completey evacuated will not be stored in the new snapshot. +If you specify an ``--include`` pattern which will not include anything useful, you will still +create a new snapshot if the original snapshot contained one or more empty subdirectories. + It is possible to rewrite only a subset of snapshots by filtering them the same way as for the ``copy`` command, see :ref:`copy-filtering-snapshots`.