I have a small problem: When I create backups, I use
restic -r s3:... backup /data
Now I created a script to back up something by ID, and you can select between some folders (override prod data, restore it temporary, restore it permanent as hash in folder name). The Problem is, if I would restore it somewhere, I always have this ugly data parent folder I want to remove. If I overrode the /data folder, there would be another data folder inside it. How can I fix that? I tried some things like
but didn’t work.
Thank you in advance
If I understand correctly you have something like:
I don’t think restic supports adjusting the folder hierarchy. You can
include stuff to select what is going to be restored, but afaik it can’t remove an empty parent. This is because
/data might have some other stuff on it, so keeping the hierarchy is (imho) better choice.
If you don’t have many folders to backup and you really don’t like a parent folder, why not backing up like
restic backup /data/your_folder ? If my above assumption is correct of course.
The problem is, that I cannot influence how many folders will be in there and I need to back up all of them. Also backups already exists and and I cannot say hey let’s just delete all of them, I would be glad to find a good solution. Otherwise I would do a workaround and restore it into a tmp folder and copy folders then to the destination folder
I might be totally dense here, but I don’t understand what you are asking or what the problem is Can you please clearly give concrete examples of what you have and what you want to have, and what the actual problem is? There’s little point in us guessing what you mean.
Sorry for advertising rustic (I’m the author of rustic), but there is the following syntax which IMO solves your problem:
rustic -r <REPO> restore <SNAP-ID>:/data /path-to-restore/
which only restores the
/data sub-tree of the given snapshot AND does not create a
data folder under
/path-to-restore/, but only all contents of the
Of course this works with every snapshot sub-tree.
So I suggest you submit a feature request to restic to also use implement this syntax (or use rustic to do the restore).