Ignore folder except 1 subfolder

I created similar dir structure in a temp folder.

$ tree AppData/
AppData/
├── data
│   └── aaa.txt
├── rrr.txt
└── Roaming
    ├── bbb.txt
    ├── ccc.txt
    │   └── cc
    └── ThisFolder
        ├── ffff.txt
        └── xxxx
            └── gggg.txt

configured exclusions:

$ kopia policy show /Users/kptsky/Temp
...
Files policy:
  Ignore cache directories:             true   inherited from (global)
  Ignore rules:                                (defined for this target)
    /AppData/*
    !/AppData/Roaming
    /AppData/Roaming/*
    !/AppData/Roaming/ThisFolder
  Read ignore rules from files:                inherited from (global)
    .kopiaignore
  Scan one filesystem only:            false   inherited from (global)
...

and created snapshot of my Temp folder.

Result:

$ kopia ls -r k5b5dbe2f302180259be6f5ceede9a4af/AppData
k5b5dbe2f302180259be6f5ceede9a4af/AppData/Roaming/
k5b5dbe2f302180259be6f5ceede9a4af/AppData/Roaming/ThisFolder/
k5b5dbe2f302180259be6f5ceede9a4af/AppData/Roaming/ThisFolder/xxxx/
k5b5dbe2f302180259be6f5ceede9a4af/AppData/Roaming/ThisFolder/xxxx/gggg.txt
k5b5dbe2f302180259be6f5ceede9a4af/AppData/Roaming/ThisFolder/ffff.txt

All works. Maybe on Windows things behave differently? Double check this “\ vs /” thing. Unfortunately no idea how it should be on your OS.

But does not look like there is a bug in kopia. At least not for exclusions parsing.

PS. Also very similar thread from the past. Looks like ppl used such exclusions on Windows successfully: