read patterns for current directory from --patterns-if-present
- 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
Assessment
This issue has not been assessed yet.