Just a question from a Restic newbie:
What is the internal format of the exclude file and how are the patterns are separated? It’s the same as in the --exclude parameters with comma separated list on one line or it’s possible to separate the pattern with new lines?
The exclude file uses newlines to separate patterns.
@cdhowie is right, for the exclude file, each pattern must be on a new line. For the command line, you need to specify --exclude
once per pattern. It’s not possible (without shell expansion magic) to pass multiple patterns in one --exclude
.
Just figured out, the following working exclude pattern filter:
–exclude={patter1,patter2,patter3,…,patter(n)}
e.g. --exclude={/dev,/media,/mnt,/proc,/run,/sys,/tmp,/var/tmp}
Note that this is shell-dependent and it may not work with all shells.
How is the pattern syntax defined? Do they allow wilcards or regex syntax? When I want to filter all the .cache directories of the different /home/$HOME/ is it possible to aggregate it in on expression or does it need a own filter for each of the different /$HOME/ user? I really go confused with a lot of the filters didn’t filter. Maybe it’s a good idea for a own Filter thread to share experiences ans solutions ?
A simple --exclude=.cache
will ignore all files and directories with that name. See this section of the restic manual.