borgbackup / borgbackup/borg

read patterns for current directory from --patterns-if-present

Open
#3,999 0 comments 1 reaction 0 assignees View on GitHub
patterns
Dominant language
Python
Stars
13.7k
Forks
875
Avg merge
11h 15m
Merged PRs (30d)
192

Description

The problem with `--exclude-if-present` is that there is no fine grained control over what is included or excluded from the directory where the file/dir is present, it's just all or nothing (with the exception of the tag file itself).

Suppose you have a coding project where you want to exclude the output directories/files from the backup (e.g. the `.o` files from C/C++ or the `.class` files from Java). Or you have some directory structure with data that is located beneath a directory `maindir` and you occasionally create some ZIP archives in `maindir` too that you do not want to have backed up. Excluding all ZIP files from the backup may not be what one wants and adding everything to a host-global exclude list is cumbersome.

If there was a local `.borgbackup.patterns`, one could define the excludes relative for the current directory, e.g. a file `javaproject/.borgbackup.patterns` with the following contents:

```
P sh
- out/*.class
- *.zip
```

would exclude these files from the backup:

```
javaproject/out/DontBackup.class
javaproject/snapshot.zip
```

The locally defined includes/excludes would be prefixed by the currently processed dir. That means `out/*.class` would effectively be `/path/to/javaproject/out/*.class`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.