About `--files-from` file format


I was wondering that it would be best to run my restic backups using the --files-from flag and a file with the list of items to be backed up. But I was not able to find how to put files and directories in such file.

There’s some kind of “pattern”, format, for that? Or I can simply put one item per line, for example?

Thanks in advance.

1 Like

Have you checked documentation? Which part is not clear there?

1 Like

Well, I had. And done it again and again. After an extensive search, finally I found a mention to the --files-from file pattern.

But it was just a very tiny mention, that I hadn’t seen in previous searches, unfortunately. Even searching on Google I had not seen nothing related.

Sorry for the trouble.

1 Like

This is from docs:

The argument passed to --files-from must be the name of a text file that contains one pattern per line. The file must be encoded as UTF-8, or UTF-16 with a byte-order mark. Leading and trailing whitespace is removed from the patterns. Empty lines and lines starting with a # are ignored and each pattern is expanded when read,

Patterns are explained just few paragraphs earlier - here

Just try and when you have problem we can try to clarify.

And when you search for files-from on this forum you can see countless posts…

1 Like

Yes, that was the mention I found and mentioned in my previous post.

I don’t know why I haven’t see it in previous searches.

Thank you, and sorry once again.

1 Like

No reason to be apologetic. But also no reason to ask questions before even trying anything.

1 Like

The docs refer to the function filepath.Glob which then refers to filepath.Match. There, the “glob syntax” is explained in more detail. Would it make sense to link to the Match function directly?

1 Like

That would indeed be much better. Are you willing to open a PR for that?


Are you working on Windows or Linux?

Here is a pull request with my proposal: Link to Go Match syntax directly in 040_backup.rst by joram-berger · Pull Request #4670 · restic/restic · GitHub

1 Like