Match: syntax error in pattern

I need to exclude files older than 90 days without modification from the backup. I generated the file list with the following command:
$ find ‘d:\DATA’ -type f -mtime +91 > ignore.list

$ wc -l < ignore.list
837542

When I run restic, it returns the following message:
$ restic -vvv … backup --exclude-file ignore.list ‘d:\DATA’
Match: syntax error in pattern Match: syntax error in pattern … Match: syntax error in pattern

scan finished in 26849.427s: 29649 files, 721.915 GiB

Microsoft Windows Server 2016 Standard
restic 0.12.0 compiled with go1.15.8 on windows/amd64

Thanks

Could you perhaps include a few lines from ignore.list? It looks very much like the format in that file is not what restic expects.

Do any of the paths contain a $, ?, [, *?

Some examples:

d:\DATA/1- Clientes/AX900/Apresentação/m/fundos/s_01/s_titulo.png
d:\DATA/1- Clientes/AX900/Base (origem)/img_f.jpg
d:\DATA/1- Clientes/AX900/296cf7f+dbbc.cfa
d:\DATA/1- Clientes/AX900/~$Expert.pptx
d:\DATA/1- Clientes/AX900/RD [MOV]/Donalds.mov
d:\DATA/1- Clientes/AX900/04-09-2020.txt
lost+found
$$RECYCLE.BIN
System Volume Information
Thumbs.db
.DS_Store
.Spotlight-V100
.Trashes
~$$*
~*.tmp

Yes. Restic could indicate which pattern is failing.

Yes. Restic could indicate which pattern is failing.

That’s a valid point, it would probably be helpful if the error message printed the line of the file that has the syntax error. Seems like a valid issue to report through the issue tracker, although it might not make it to the top of the priority list.

The exclude patterns seem to use go glob expansions:

https://pkg.go.dev/path/filepath#Glob

So in order to use the output of file listing commands as an include list, it would probably be helpful if there existed a small utility to escape lines of fixed filenames and convert them into glob patterns that match only those filenames. Anyone know of a utility or simple way to achieve this?

Perhaps this is only an issue on Windows and has therefore received less attention?

AFAIK there is no escape mechanism for file-globbing under Windows. See filepath · pkg.go.dev

1 Like