Prevent restic restore to override local storage

Hello everybody.

I have a question about restic restore.

I’m willing to use restic to save one massive ftp server and restore it to a new one.

The thing is, when this restore will be done, the new server will already be online and used by clients.
Some clients do not only add new files but also modify old ones (reuploading a new version of on old file with the same name).

When restoring old datas from the backup, new files on new server remain untouched but old (edited) files on new server are overriden by the backup version.
This is undesirable because file version on new server is more recent than backup version.

Therefore, I would like to restore unexisting files on new server but ignore files who are both present on new server and in the backup.

I didn’t find any way to do that (except than restore in an empty folder, and then move only desired files to the target location, but this prevents me to automate this task.)

Is there any way to do this ?

Sorry for bad english !

The restore command does not have a way to restore only “older” parts of a directory tree than what already exists on disk, no.

You could mount the repository and then use rsync or similar to sync only newer files from it into your target directory tree. But I would highly recommend against restoring onto an active storage are that your users are using. At the very least use the dry run option of rsync to make sure that the result would be as you intend, if you do this.

Another option is to simply restore all of it, perhaps with some inclusion/exclusion using the corresponding flags (see restic help restore) to a temporary area, and then rsync from there into your “live” area. Again making sure that the rsync works as intended before doing it for real.