Exclude top-level directories of the backup source via relative path
Output of restic version
restic 0.8.3 compiled with go1.10 on linux/amd64
What should restic do differently? Which functionality do you think we should add?
Paths in exclude files are applied to the full path of a file. Currently there seems to be no solution to exclude only top-level directories in the backup source folder(s) without specifying their full paths.
It should be possible to exclude a top-level directory of the backup source, e.g. by a path that's relative to the backup source folder such as ./Downloads.
What are you trying to do? What problem would this solve?
Assume we want to backup multiple directories that have similar layouts, e.g.
backup-source1/
-- Downloads/
-- Pictures/
-- .cache/
backup-source2/
-- Downloads/
...
These source directories could be the home directories of the system users, for example.
While we want to backup all of them, let's assume we'd like to exclude all the Downloads folders.
Currently we can
- exclude the folder on any level via
Downloads - or exclude each folder by specifying the absolute paths, individually
The first option is semantically wrong, the second contains redundancy and is harder to maintain, with quadratic growth (per source and excluded folder) of effort.
Did restic help you today? Did it make you happy in any way?
I'm sick of the backup topic and that the good tools either are incremental or have your current files navigatable - but not both.
Your project could not only replace my custom solution and finally provide a slick interface to this complex topic, which almost feels like working with git, but also offers both incremental backups as well as the ability to mount the current snapshot and have it browsable. Neat!
@sebschlicht Your restic version is quite old, the current version is 0.10.0.
That said excludes relative to the backup source folders still don't exit AFAIK. For your home folder example an exclude of /home/*/Downloads would also work. If there are home folders at a different location, that obviously doesn't help though.
@MichaelEischer Yeah, I wasn't too sure whether this feature wasn't added in the meantime but my research suggested it didn't. I didn't use a PPA but installed it from the official repositories on Ubuntu.
Thanks for the workaround, I didn't fully internalize that * isn't matched against the path separator yet!
Still I feel like having the ability to point at the backup source root would be beneficial. It allows to move the source root without changing the exclude file and to perform backups without knowing the absolute paths at all.
Spent 20 minutes testing why folder still included turns out you need to specify full filesystem path Incredible how this basic feature is not implemented
wow I thought I had been excluding but then realized it's not. Is there some big difficulty supporting glob? Now I have to make a script that creates a massive exclude file