Windows restore --include-file and escaped characters

Hi there, I have a particular file I’m trying to extract from backup, but I can’t figure out how to escape the name correctly on Windows using restic 0.17.3.

The path is:

/f/UserData/Pictures/Set05/2018/2018-09-09 - Bernal/[Originals]/DSC01491.JPG

The brackets are causing the problem. I tried doing [Originals], [[Originals]], putting the whole line in quotes - none of that worked.

Note that this is when restoring via a file include list, not command line.

restic restore --target C:\temp\restic_restore --include-file .\file_list.txt latest

What do I need to do to escape that correctly? Funnily enough, go.dev filePath Match has an ominous line reading “On Windows, escaping is disabled”. That can’t be right.

Thanks!

You can use Restic Browser is more easy for a single file:

Is just an ejecutable file
For Windows:
https://github.com/emuell/restic-browser/releases/download/v0.3.2/Restic-Browser-v0.3.2-windows.zip

Hey, it seems like you might have hit this issue perhaps?

See also: Restic 0.16 windows - include does not work

If so, a suggested solution in that issue was to enclose the opening square bracket in another set of square brackets to escape it. I take that to mean something like this might work:
/f/UserData/Pictures/Set05/2018/2018-09-09 - Bernal/[[]Originals]/DSC01491.JPG

Unfortunately, I don’t currently have easy access to a windows machine to test the above. FWIW, some quick testing in Linux shows single-quoting your entire file path works, so it does indeed seem like this is a windows specific issue.

Thanks for the tip, shd2h. Unfortunately that didn’t quite work - oddly enough it created a folder named [[Originals]], which is not what I expected.

It’s a bit disheartening that this issue has been open since 2022. Ideally we should be able to supply a file list that will be interpreted literally, not expanded, similar to backup --files-from-verbatim and --files-from-raw. There’s a reason those options exist on backup, and the situation here is analogous.