Bacula-users

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

2015-08-27 11:02:44
Subject: Re: [Bacula-users] fileset which only compresses files which are not already compressed like gzip, jpeg, mpeg
From: Ana Emília M. Arruda <emiliaarruda AT gmail DOT com>
To: Martin Simmons <martin AT lispworks DOT com>
Date: Thu, 27 Aug 2015 12:00:36 -0300
Hello Martin,

Thank you.

On Thu, Aug 27, 2015 at 6:20 AM, Martin Simmons <martin AT lispworks DOT com> wrote:
>>>>> 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 ...").

​Yes. A beginner´s mistake. I´m sorry. I was testing things because It seems that bacula do not treat lookahead and lookbehind assertions. C++ regex.h uses ECMAScript grammar which allows assertions. But tests using bregex with no success.
 

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.

​This is the way I have been using for this situations. But I was wondering If in the case of the need of a string negation, how this could be possible.

Best regards,
Ana
 

__Martin

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