Include vs Exclude in .kopiaignore

I’m having trouble understanding the syntax for including vs excluding files and folders. I found various topics on stack overflow with suggestions that weren’t working. That could have been user error, but they refer to .gitignore and my understanding is there isn’t 100% parity between that and kopia’s implementation.

My short term goal is simple: whitelist a subset of file types found anywhere in the source. So: exclude all, include *.ai, for example.

Long term, I’d just like an understanding of how more complex filtering can be achieved, especially if kopia continues to differ from .gitignore.


1 Like




Thanks for the suggestion. Unfortunately this doesn’t work for me, both in the UI or by putting it in the .kopiaignore file.

It creates an empty backup, which I don’t understand. It seems simple enough:

*       [back up nothing]
!*.ai   [escape the above for any file with the .ai extension]

My only guess is kopia doesn’t support this function of .gitignore, but I don’t know for sure because I can’t find any documentation on it.

I currently have a super long list of all the stuff to ignore and my backups are still picking up all kinds of files I don’t need backed up. I could play whack-a-mole indefinitely this way, adding more and more file types and folder names to to the ignore list, but I have to get work done eventually…!

Also (side-rant), because I can’t figure out how to globally flag “case insensitive,” each file type needs multiple entries (eg. JPEG, Jpeg, jpeg, JPG, Jpg, jpg…) which is just salt in the wound. With normal regex commands this would have taken minutes and a few simple lines. Any ideas??? :frowning_face:

It’s my understanding, that you can’t include anything - its only excluding. You may argue about the validity, but I am sure, that there will be valid reasons for either approach and Kopia chose to include everything by default and only to exclude specific items.

Excluding everything in the first place will not help, since the gitignore docs clearly state that once an item has been ignored it cannot be included again.

Can you try with more recent build (unstable channe)? We had some major improvements to ignore handling.

OK, had a chance to test more. Here are my findings with Version v20210302.0.82937 built on Tuesday, March 2, 2021 4:36:51 PM fv-az15-142 using the “.kopiaignore” file.

I can get it to exclude everything except certain file types if I also explicitly include each directory that makes up the path to the files I want included. For example, if I want .ai files in the path /a/b/c/d I need to do:


However, I want it to match .ai files for all 100’s of subfolders inside of /a/ so this won’t do.

After re-reading the .gitignore documentation, I found the command, ** which should allow me to not only list the directory in the above example with 1 line (!a/**/d) but it should allow me to get exactly what I want with:


…but it doesn’t work. I tried using ** every which way and couldn’t get it to do a thing.

This has been proven false. The tools at one’s disposal to do such a thing exist, and are semi-documented via .gitignore, but they are a bit hostile.

Also, I fully reserve the right to claim user error :innocent:. Most of my findings and frustrations so far are the result of guess and check - I’m just poking at this thing with command after command and seeing how it responds and, like a slot machine, I can’t seem to stop until I’ve hit the jackpot.


wow, so… jackpot???

*Audio Previews*

Found by dumb luck mixed with an inability to stop trying. I was messing with ** and as long as you have it listed as the literal path itself (and NOT as a pattern variable to an actual path), you can then list the file types you want included and it will drill down into all subfolders and grab each specified file type for backup.

The above example is my current working test file. It ignores everything except the listed file types, and it will still respect specific exclude patterns (eg. *[aA]uto-[sS]ave*)

Hope this helps another “me” avoid having to go through all that testing to figure it out!