0

After reading documentation and many blog I still can't figure out what is missing in my FileSet so Bareos backup only csv and pdf files:

FileSet { 
  Name = "HQ ccomp" 

  Include { 
     Options {
        IgnoreCase = yes
        WildFile = "*.csv" 
        WildFile = "*.pdf" 
        Exclude = no 
     } 

     File = "e:/folder/emails" 
  } 
}
elsadek
  • 211
  • 2
  • 12
  • _The *.Z and *.gz files will indeed be backed up, but all other files that are not matched by the Options directives will automatically be backed up too (i.e. that is the default rule)_. [http://doc.bareos.org/master/html/bareos-manual-main-reference.html#FileSetExamples] (http://doc.bareos.org/master/html/bareos-manual-main-reference.html#FileSetExamples) – elsadek Apr 12 '16 at 14:22

1 Answers1

1

The Exclude mechanism in Bareos/Bacula is quite baroque. Your fileset will by default include all files below your specified directory, and *.csv doubly so. This is an instance of Configuration 9.20 - non-working example in the documentation.

In other words, you need a rule to exclude everything to make the WildFile parameter have effect. The idiomatic way of writing this is to add another Options section at the bottom of your Include section:

Options {
   RegexFile = ".*"
   Exclude = yes
}

It is important that you use RegexFile or WildFile, since Bareos will not descend into sub-directories if the exclude rule matches a directory.

Ordering matters: The first Options section which matches a file or directory will decide what to do.

The wildcard and regular expression pattern matching parts of the Options resources are checked in the order they are specified in the FileSet until the first one that matches. Once one matches, the compression and other flags within the Options specification will apply to the pattern matched.