How to include files by pattern when running backup?

Is there a way to backup only files that matches a pattern? (e.g. I want to backup only files ending in .java and .t xt in the Projects folder, and ignore everything else).

I tried using wildcards in the FILE_DIR argument of backup, but that just gave me an error: The filename, directory name, or volume label syntax is incorrect.

Thanks!

It’s not currently possible.
As a workaround, you can use other tools to build a file list, and use the --files-from option when running backup.

1 Like

Are you by chance using Windows? On Linux/Unix, the shell is responsible to expand e.g. restic backup *.java into restic backup foo.java bar.java baz.java, so restic does not need to do that, so we did not implement expanding wildcards in restic’s arguments. On Windows, restic will then try to open the file which is literally named *.java, which does not exist.

There’s an issue which contains a bit of background discussion here: