2
2
mirror of https://github.com/octoleo/restic.git synced 2025-01-12 18:31:10 +00:00

restore: document --delete option

This commit is contained in:
Michael Eischer 2024-06-29 22:21:27 +02:00
parent 868219aad1
commit 569f111cb1

View File

@ -111,6 +111,27 @@ values are supported:
newer modification time (mtime).
* ``--overwrite never``: never overwrite existing files.
Delete files not in snapshot
----------------------------
When restoring into a directory that already contains files, it can be useful to remove all
files that do not exist in the snapshot. For this, pass the ``--delete`` option to the ``restore``
command. The command will then **delete all files** from the target directory that do not
exist in the snapshot.
The ``--delete`` option also allows overwriting a non-empty directory if the snapshot contains a
file with the same name.
.. warning::
Always use the ``--dry-run -vv`` option to verify what would be deleted before running the actual
command.
When specifying ``--include`` or ``--exclude`` options, only files or directories matched by those
options will be deleted. For example, the command
``restic -r /srv/restic-repo restore 79766175:/work --target /tmp/restore-work --include /foo --delete``
would only delete files within ``/tmp/restore-work/foo``.
Dry run
-------