Trouble with ignored directories


I only discovered Kopia yesterday and I really like it so far. I only have one problem with it – ignoring files/directories. I am a (now former) Borg user and in Borg it is so easy to write a file containing a list of directories you want to exclude from the backup, each on one line, and then do borg create --exclude-from "/path/to/the/exclude/file" ...

You might say that Kopia has a similar function. The problem I have with .kopiaignore is that you can’t specify the absolute path of the ignored directory, hence risking the chance that by blacklisting a directory abc, the directory /this/is/a/long/tree/abc gets accidentally blacklisted as well. Which is very scary for a backup system. I am also not a fan of polluting my system with a multitude of .kopiaignore files.

As far as I understand it, the only other option left is creating ignore policy rules. Although I am having the same problem with the relative paths, I found a small workaround thanks to this post. By executing kopia policy set --add-ignore '*' ~/Downloads /tmp /any/other/dir I can create ignore rules based on absolute paths (hallelujah).

There are only two problems with this solution: first of all, single files can’t get blacklisted with this workaround, it seems to be for directories only. Secondly, there is no trace of which directories deep down in the system structure I have instructed Kopia to ignore. Sure, I could manually keep a list, but this should fundamentally be Kopia’s task to tell me what directories aren’t being backed up (each snapshot only gives me 10 examples of those).

I really like Kopia and all the benefits there are to it compared to Borg. I just really need to get over this big hurdle. Or am I just not getting the chain of thought behind the relative paths?

I am excited to hear your opinions, thanks for hearing me out.

Okay, let me ask a question, maybe I am just not getting it:

Let’s say you are looking at the top of the Kopia repository and have this structure:

├── dir/
│   ├── file1
│   └── file2
├── dir2/
│   └── dir/
├── file3
└── file4

How do you ignore ./dir without also ignoring ./dir2/dir which happens to have the same name?

Yeah, ignores today are quite messy and sometimes lead to weird side-effects because of inheritance.

The original idea to focus on relative paths seems like a bad one in the hindsight as most people want the absolute paths.

We should definitely revisit/simplify/improve this in the next version. Any concrete ideas for the UX are more than welcome.

Thanks for your answer, it confirms my suspicion that it really is a bug and not my own shortcoming.

I have created an issue on GitHub and included a proposed solution.