Restoring individual folders or files not working

First, here’s my snapshot from a test repo:

ID        Date                 Host            Tags        Directory
990cc2ff  2017-11-10 12:04:26  computer┌── e:\temp\folder duo
                                                       └── e:\temp\folder one
d1285463  2017-11-10 12:10:51  computer┌── e:\temp\folder duo
                                                       └── e:\temp\folder one

I’m trying to restore a specific folder using this command:

restic -r bak_repo restore latest --password-file passwd.txt --target restore-here --include "e:\temp\folder one"

However, I’m not seeing the folder restore-here. If I remove the --include parameter, the folder restore-here will appear with everything in it.

Hey, welcome to the forum!

The problem here is a limitation that restic currently has, the way you create the snapshots it will create the following structure (you can check with restic ls 990cc2ff):

/folder one
/folder duo

For restore, the include/exclude patterns are relative to the structure in the repository. So if you like to only restore folder one, you need to pass --include "/folder one" (mind the quotes).

Does that work?

That does seem to work.

I added a folder one inside folder duo. When I ran the command to restore it, it restored both instances, in both directory tree.

I attempted to specify temp\folder one, temp/folder one but that didn’t produce anything.

Can one be more precise?


I just noticed with restic ls, that temp isn’t featured in the tree structure.

What did you run exactly? Running restic restore --include "folder one" will indeed restore both folders, but restic restore --include "/folder one" (mind the prefixed slash) will only restore the top-level folder. The output of restic ls matches this.

The temp folder is not included because of an issue in the current restic archiver code. I’m currently working on it and it’s documented in #549.

The bug you reference seems to replicate what I’m facing. I’ll will subscribe and keep tabs on it. Thanks.