Skip to content

Option for restic restore to delete local files not in snapshot #2348

@tesujimath

Description

@tesujimath

Output of restic version

restic 0.9.4 compiled with go1.11.4 on linux/amd64

What should restic do differently? Which functionality do you think we should add?

Add a command line option to restic restore, say --delete, which causes restic to delete any local files not in the snapshot.

What are you trying to do?

I want to restore the directory (the whole of which has been backed up by restic) to a snapshot. Which ought to be able to delete anything which was added since the restic snapshot was created. (I am used to this kind of behaviour from snapshots in ZFS, for example.)

The particular case I am considering is a WordPress installation. I took a restic backup prior to installing some plugin, which I then realise is garbage, so I want to revert. Which should also mean, delete any new files which got installed. Say I have 100GB in my WordPress directory. It’s ridiculous that I have to delete everything, and let restic restore it all from the snapshot. Restic is already scanning the filesystem (to work out what to restore), so should be easy for it to say, hmm, a new file or whole subdirectory not in my snapshot, perhaps the user would like to delete it?

Did restic help you or made you happy in any way?

Yes, in general I am loving restic. Who'd have through there was space for innovation in this area? Good job!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions