Bacula-users

Re: [Bacula-users] fileset which only compresses files which are not already compressed like gzip, jpeg, mpeg

2015-08-27 05:25:14
Subject: Re: [Bacula-users] fileset which only compresses files which are not already compressed like gzip, jpeg, mpeg
From: Martin Simmons <martin AT lispworks DOT com>
To: Ana Emília M. Arruda <emiliaarruda AT gmail DOT com>
Date: Thu, 27 Aug 2015 10:20:36 +0100
>>>>> On Wed, 26 Aug 2015 19:50:04 +0000, Ana Emília M. Arruda said:
> 
> Hello Luc,
> 
> You"re right. I misunderstood the issue here and thought that Martin need
> to exclude compresses files from its backup.
> 
> I think the bellow now will work as desired:
> 
> FileSet {
> Name = "Full Set"
> Include {
> Options {
> Compression = gzip
> RegexFile = ([^\.g?zip]|[^\.jpe?g])$
> }
> Options {
> Signature = MD5
> RegexFile = (\.g?zip|\.jpe?g)$
> }
> File = /
> }
> }

The first RegexFile is wrong because you can't just wrap [^...] around
something to make a negative (the [^...] syntax means "match one character not
in ...").

It doesn't need the negative if you swap the two Options clauses, because
Bacula takes the options from the first clause that matches.  It uses the last
Options clause that has no matching clauses (Wild, RegexFile etc) for all
other files.

This will work:

FileSet {
  Name = "Full Set"
  Include {
    Options {
      # Options for files that are already compressed
      Signature = MD5
      Wild = *.zip
      Wild = *.gzip
      Wild = *.jpg
      Wild = *.jpeg
    }
    Options {
      # Options for everything else
      Compression = gzip
      Signature = MD5
    }
  }
  File = /
}

I also used "Wild" instead of "RegexFile" because I think it is clearer to
list them.

__Martin

------------------------------------------------------------------------------
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users