How to avoid absolute path if restoring

Hi guys,
i backuped a lot of applications into one restic repository. If i restore one of the applications i always get the folder structure of the absolute source path.

For example if i restore following tool to “D:\restore”:

addd8db2  2023-07-18 15:46:10  DESKTOP-FHUVOR7  Matlab    Z:\Software\Matlab

I get folder structure:
D:\restore\Z:\Software\Matlab

I would like to get:
D:\restore\Matlab

I think somehow i have to backup in another way ? I havent found the info i need in the docu yet. Maybe anybody with more knowledge can help me ?.

Thank you :slight_smile:

1 Like

See Restoring from backup — restic 0.16.0 documentation : restore <snapshot>:<subfolder>, so try adding :Z:\Software right after the snapshot ID in your restore command. I haven’t tried it with Windows and its drive letters, so can’t say exactly how it works there.

EDIT: Note that for this to have a chance of working you must be using restic 0.16.0 or newer.

2 Likes

IIRC the windows drive is saved as a one-letter path, so it should be <snapshot>:Z/Software/.

3 Likes

The best way is to check how paths are stored in snapshot with restic ls command.
In Windows restic is CASE-sensitive.

2 Likes

Puh i didnt expect a different path handling here. Is there any chance of creating a backup without saving the full path ? Best would be to only save the last folder. for example “Matlab”

@KamikazeePL Good idea. I can see that the path string is different to windows. No ‘:’ for example.

1 Like

if you run backup with a relative path, then the backup will only contain that:

$ cd /D Z:\Software
$ restic backup .\files
$ restic ls
/files/...
$ restic snapshots
012345678 2023-01-02 03:04:05 hostname Z:\Software\files
4 Likes

@MichaelEischer Your solution works perfect for me. Thank you for doing a great job with restic :clap:
And sorry for my late response :beach_umbrella:

1 Like

Is there no option to backup using the absolute path but without including the full path in the backup? I had the same problem with borg and it would be amazing if we could have this option. For example:

I don’t want to create bash scripts like this:

cd /folder/to/backup
restic backup .

It would be much better to have an option where we could use an absolute path without including the full path in the backup like this:

restic backup --partial-path /folder/to/backup

or something like that.
Any chance of an option like this?

You already found the issue about it, Backup option to remove a leading path prefix · Issue #2092 · restic/restic · GitHub

Yes I should have clarified. I found the Issue after writing the comment in this forum. Thank you for adding the info!

1 Like