Restic on Windows

Hi, I wrote a backup script for Windows and it works properly, but I’m not able to restore specific files into backup position (not a tmp path).
Can someone help me?

Welcome to the restic forum @federicoballarini!

If you want an actual answer to your question, you probably need to be more specific about what the symptoms of the problem are.

Hi @rawtaz

I have a restic repo on an external NAS. I’m trying to restore with this command:

restic -r %destination% --password-file %pwdfile% restore %snapshot% --target "%position%" --include "%pathname%"

where %position% = C:\Users\Administrator\Downloads
and %pathname% = C:\Users\Administrator\Downloads\test.pdf which is the file to restore.

But what I’m obtaining is C:\Users\Administrator\Downloads\C\Users\Administrator\Downloads\test.pdf instead of C:\Users\Administrator\Downloads\test.pdf

Can you help me?
Thanks!

1 Like

I don’t believe that in-place restores are currently supported on Windows due to the way that restic encodes the drive letter in the stored path.

Note that this is only an issue if the backup is taken using a path containing a drive letter (restic backup C:\). I believe that using restic backup \ while the working drive is C will not store the leading /C directory component.

See also this feature request that I filed:

2 Likes

I restored without C:\ and now it is restored as: C:\Users\Administrator\Download\file.pdf\Users\Administrator\Download\file.pdf

It’s normal?

Yes. In this case you would restore with --target=\

Personally, restoring to the proper place right away is something I never do. Better to get it restored in a safe place (i.e. a folder made for the restore) and then move the files to where they should be. This gives you the most safety and control.

2 Likes

Yep, even on Linux where you can easily to in-place restores, I usually restore with --target=/tmp and then move the files back to where they were. Or, I at least test with --target=/tmp first before switching to --target=/ to make sure that it only restores what I wanted.

run CMD as administrator

cd \d C:\
mklink c C:\

All will work as expacted