[Borgbackup] Pattern questions

David Gasaway dave at gasaway.org
Fri Jan 26 00:06:11 EST 2018


Hi,

I've been playing with using --pattern in an attempt to write a borg
handler for backupninja.  I already got some questions answered in the bug
tracker, but still not quite grasping something.  For example, let's say I
have this command line...

borg create --list --dry-run --pattern 'R/' --pattern '- /*'
/backup/ninja-test::Test3

I would expect nothing to get listed, as everything should match the first
exclude pattern.  Yet, it will start to list every file on the system.  If
I try this...

borg create --list --dry-run --pattern 'R/' --exclude '/*'
/backup/ninja-test::Test3

I get nothing, as expected.  If I modify it to this...

borg create --list --dry-run --pattern 'R/' --pattern '+ /home/*' --exclude
'/*' /backup/ninja-test::Test3

I still get nothing, which is not what I would expect.  The documentation
states, "The first matching pattern is used so if an include pattern
matches before an exclude pattern, the file is backed up."  It is probably
referring to an include --pattern followed by an exclude --pattern.  But if
I try this...

borg create --list --dry-run --pattern 'R/' --pattern '+ /home/*' --exclude
'/*' /backup/ninja-test::Test3

I'm back to where I started -  a list of every file on the system.  The
documentation also states, "Patterns (--pattern) and excludes (--exclude)
from the command line are considered first (in the order of appearance)."
This makes me think the third example should have worked.  Are --excludes
always evaluated regardless of matches to any prior --pattern?

Let me set up a concrete scenario.  Suppose I wanted a backup of all home
directories that start with 'a' using only patterns.  How would this be
done?  The following does not work...

borg create --pattern 'R/home' --pattern '+ /home/a*' --pattern '- /home/*'
/backup::archive

Thanks.

-- 
-:-:- David K. Gasaway
-:-:- Email: dave at gasaway.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/borgbackup/attachments/20180125/9844094a/attachment.html>


More information about the Borgbackup mailing list