I’m in the process of moving a machine. So using restic restores as a method of getting content from the source machine.
I can restore my docker data with a simple restore
restic restore 21ce0dd1 --include /source/Melkor/zdocker --target /mnt/restic
But now I have a folder that I want to restore (docker-data) but exclude certain folders.
I can’t do a:
restic restore 21ce0dd1 --include /source/Melkor/docker-data --exclude /source/Melkor/docker-data/baddata
Is my only option to use multiple --excludes on the restore?
restic restore 21ce0dd1 --exclude /source/Melkor/docker-data/baddata -exclude /source/Melkor/zdocker
to exclude everything from the full backup I don’t want.
restore
currently only supports either --include
or --exclude
flags. But you can use the snapshot:subpath
syntax supported by recent restic versions instead:
restic restore 21ce0dd1:/source/Melkor/docker-data --exclude /baddata --target /somewhere
revisting this, and saw a similar query where subpaths were recommened: Restore specific folder with spaces in the path
But similar to the link thread here is the command:
restic restore --target /mnt/restic "latest:/media/serverfolders/tv/ --include "Formula 1 Drive to Survive/Season 6/Formula 1 - Drive to Survive (2
019) - S06E09 - Threes a Crowd.nfo"
Gets a: bash: syntax error near unexpected token
('`
Or without subpath:
restic restore latest --target /mnt/restic --iinclude "/media/serverfolders/tv/Formula 1 Drive to Surv
ive/Season 6/Formula 1 - Drive to Survive (2019) - S06E09 - Threes a Crowd.nfo"
Fatal: more than one snapshot ID specified: [latest 1 Drive to Survive/Season 6/Formula 1 - Drive to Survive (2019) - S06E09 - Threes a Crowd.nfo]
No matter if I surround the included file/path wtih " or escape with \ it always stops on that first space in Formula 1
@psyciknz there is a typo in both your examples.
first one is missing a " and second one has --iinclude instead of --include.
can you try this:
restic restore --target /mnt/restic "latest:/media/serverfolders/tv" --include "Formula 1 Drive to Survive/Season 6/Formula 1 - Drive to Survive (2
019) - S06E09 - Threes a Crowd.nfo"
or
restic restore latest --target /mnt/restic --include "/media/serverfolders/tv/Formula 1 Drive to Surv
ive/Season 6/Formula 1 - Drive to Survive (2019) - S06E09 - Threes a Crowd.nfo"
if the syntax error on the ( still shows up you can try to replace the “” with single quotes ’ '.
I thought to include a single file it was —Iinclude
I’ll give those a go.
I did look before I replied but not good enough.
For the record: --iinclude
exists and it is the case-insensitive version of --include
.
There are case insensitive variants of --exclude
and --include
called --iexclude
and --iinclude
. These options will behave the same way but ignore the casing of paths.
There are also --include-file
, --exclude-file
, --iinclude-file
and --iexclude-file
flags that read the include and exclude patterns from a file.