2

Trying to do what seems to me like a very simple exclude in a Fileset.

Basically I want to Include /root and /home and exclude all directories named .cache and Downloads.

FileSet {
  Name = Exclusion_example
  Include {
    Options {
      Signature = SHA1
    }
    File = /root
    File = /home
  }
  Exclude {
    File = Downloads
    File = .cache
  }
}

I've tried moving these to the Options section and use Exclude=yes. I've tried with WildDir/WildFile yet it doesn't seem to be correct when I use the 'estimate' command: these files are still listed.

Can someone give the exact syntax here? I've looked into the BareOS and Bacula docs and none of them seem to explain me what I'm doing wrong.

1 Answers1

2

After a lot of fiddling I got it working with the below:

FileSet {
  Name = "MyFileSet"
  Include {
    Options {
      signature = MD5
      Exclude = yes
      WildDir = "*/\.cache"
      WildDir = "*/Downloads"
    }
    File = /root
    File = /home
  }
}

The Include section adds /root and /home files and the Options section excludes the ones you don't want. The options section allows WildFile and WildDir, the Include and Exclude section doesn't. A dot has to be escaped. Note that using 'Downloads' instead of '*/Downloads' will not give you desired result.

You could add more Include sections but the logic in which these are applied together with Exclude sections is not really transparent.

Always use the 'estimate' command to see which files would be backed up and see if the exclusion works as you expect.

I suggest reading these 2 sections from the docs fully (they'll give you better insight in the mechanism):

https://www.bacula.org/5.0.x-manuals/en/main/main/Configuring_Director.html#SECTION001870000000000000000 https://www.bacula.org/5.0.x-manuals/en/main/main/Configuring_Director.html#SECTION001880000000000000000

Hope this helps someone else.