Skip to content

add include patterns #1406

Description

@leo-b

Sometimes the ability to not only exclude patterns but also explicitly specify includes can be useful.

I propose a new optional pattern prefix '+' that may be used with --exclude or in --exclude-from files to define include-patterns. (Just like include/exclude pattern rules in rsync.)

These patterns may be used to explicitly include files in a backup that would otherwise be excluded by a following pattern.

Some use cases:

  • exclude docs but backup pdfs:

    --exclude +/data/docs/pdf --exclude /data/docs/
    

    (maybe --include /data/docs/pdf should be introduced to improve readability.)

  • use a common exclude list deployed to all backup clients but override it on some specific client:

    global.inclexcl:

    /tmp
    *.tmp
    /scratch
    

    local.inclexcl:

    +/scratch
    /home/dir_to_exclude
    

    $ borg create --exclude-from local.inclexcl --exclude-from global.inclexl backup /

    equivalent:

    global.inclexcl:

    -sh:/tmp
    -fm:*.tmp
    -fm:/scratch
    

    local.inclexcl:

    +fm:/scratch
    -/home/dir_to_exclude
    

(Actually the same approach is already used by the --keep-tag-files option.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions