Inclusion / Exclusion use case?

Hi there,

thank you for providing restic. So far my experience with it has been awesome.

I have the following use case for inclusion / exclusion criteria:

A software stores a lot of intermediate files (multiple GBs) and some output files in a folder (usually called PI), this folder has 5-6 sub-directories. One of the subfolders (master) contains the output files of the process, which I’d like to backup, the other subfolders can be discarded. The names of these other subfolders may vary. All of the files have the same file type/ending (*.xisf)

How can I backup all files in PI, PI/master, but discard the rest of the files which are in PI/a, PI/b, …?

Thanks in advance, Jens

You might want to use --files-from and --exclude-file options while running backup. I don’t have enough coffee but sounds like you can use this as an exclude pattern: PI\/(?!master).*
(test case here)

Hi gurkan, thanks for the reply.

The manual says, that the fileglob package is used for --exclude(-file), with this syntax : filepath package - path/filepath - pkg.go.dev

That means that regexes cannot be used there. In addition, golangs regexes seem not to support the syntax you’re using. Which means I would need to build a more complex pipeline of creating first a list of files to backup using something like perl and then feeding that list to restic. Yeah, but…

Ah sorry then, I forgot that part. I just tried to do some magic by adding both --exclude and giving PI/master at the end as an extra folder but that didn’t work.

Maybe creating 2 consecutive snapshots would be easier: E.g. first one with --exclude PI, the other one by directly backing up PI/master?