Restore for certain folder/subfolder


I’m new to restic, and I installed it on 2 ubuntu 20.04 machines, in different location.
Machine 1 — the server which I want to backup
Machine 2 — the backup storage/repo

Here’s the case :

  • machine 1 has 2 folders which I want to backup : folder a + folder b, both in folder c
  • running restic for test, I managed to backup over sftp to machine 2 (16Gb in about 3:30 hrs)
  • I created folder C also on machine 2, just to be easier to restore and to have exactly the same structured files path
  • I backup the whole Folder C, and restore result is complete with the whole subfolders, owner permissions. No problem
  • But when I tried to restore to : folder C on machine 2, and the restored became : folder C - folder C : folder a + folder b
  • I tried with the --include option, result became : folder C - folder C : folder a or b on machine 2

Question :
Is there another way to restore folder a / b to already created : folder C on machine 2 without the parent tree folder C being recreated ? If not, then that means I have to do extra step to move the folder. Btw, restic is really fast !

Thank you

No, you’ll have to move the folder since the backed up files are restored in the structure they were backed up. It’s just one command to move it.

If it works better for you you can back up the two folders individually (but still in the same backup run) instead of the C folder, then you’ll get them restored without C.

Hi, thank’s for the reply.

Is it possible, since folder C contains : a and b. If yes, what parameter should I use when doing backup ?

1 Like

Please see restic help backup, it shows the following: Usage: restic backup [flags] FILE/DIR [FILE/DIR] ....

This means you can cd into the C folder and then run the backup such as e.g. restic backup a b (of course with the rest of the options/arguments you need, such as -r) :slight_smile: