# Ignore folder except 1 subfolder

**URL:** <https://kopia.discourse.group/t/ignore-folder-except-1-subfolder/8758>\
**Category:** General Topics\
**Created:** [December 31, 2025, 2:32pm UTC](https://kopia.discourse.group/t/ignore-folder-except-1-subfolder/8758 "2025-12-31T14:32:05Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![revolving-leslie](https://yyz2.discourse-cdn.com/free1/user_avatar/kopia.discourse.group/revolving-leslie/32/1936_2.png) [@revolving-leslie](https://kopia.discourse.group/u/revolving-leslie)\
**Post date:** [December 31, 2025, 2:32pm UTC](https://kopia.discourse.group/t/ignore-folder-except-1-subfolder/8758/1 "2025-12-31T14:32:06Z")

</div>

Hello,

What ignore pattern would ignore the subfolder \AppData except for \AppData\ThisFolder

I have tried combinations of:

```auto
\AppData

!\AppData\ThisFolder

```

and

```auto
!\AppData\ThisFolder

\AppData

```

But it just ignores ‘ThisFolder’ regardless.

---

<div class="post-metadata">

**Author:** ![kapitainsky](https://yyz2.discourse-cdn.com/free1/user_avatar/kopia.discourse.group/kapitainsky/32/535_2.png) [@kapitainsky](https://kopia.discourse.group/u/kapitainsky)\
**Post date:** [January 1, 2026, 5:12am UTC](https://kopia.discourse.group/t/ignore-folder-except-1-subfolder/8758/2 "2026-01-01T05:12:45Z")

</div>

```auto
/AppData/*
!/AppData/ThisFolder

```

---

<div class="post-metadata">

**Author:** ![revolving-leslie](https://yyz2.discourse-cdn.com/free1/user_avatar/kopia.discourse.group/revolving-leslie/32/1936_2.png) [@revolving-leslie](https://kopia.discourse.group/u/revolving-leslie)\
**Post date:** [January 1, 2026, 12:38pm UTC](https://kopia.discourse.group/t/ignore-folder-except-1-subfolder/8758/3 "2026-01-01T12:38:04Z")

</div>

Thanks but unfortuantely that didn’t work. Initially (with the forward slashes), I just got a blank AppData folder in the snapshot. When replacing with backslashes (\) that I presume Windows prefers, it snapshots the whole AppData folder, which I don’t need.

I should probably clarify that the folder I do want is actually in Roaming:

`\AppData*`  
`!\AppData\Roaming\ThisFolder`

---

<div class="post-metadata">

**Author:** ![kapitainsky](https://yyz2.discourse-cdn.com/free1/user_avatar/kopia.discourse.group/kapitainsky/32/535_2.png) [@kapitainsky](https://kopia.discourse.group/u/kapitainsky)\
**Post date:** [January 2, 2026, 5:26am UTC](https://kopia.discourse.group/t/ignore-folder-except-1-subfolder/8758/4 "2026-01-02T05:26:33Z")

</div>

Windows might require backslashes indeed. I am not familiar with this OS.

But otherwise you got what you asked for:) Be precise when you ask for help. Nobody can see your screen.

For your new requirement what you need is:

```auto
/AppData/*
!/AppData/Roaming
/AppData/Roaming/*
!/AppData/Roaming/ThisFolder

```

Kopia is using git style exclusions. Google if you need more details.

---

<div class="post-metadata">

**Author:** ![revolving-leslie](https://yyz2.discourse-cdn.com/free1/user_avatar/kopia.discourse.group/revolving-leslie/32/1936_2.png) [@revolving-leslie](https://kopia.discourse.group/u/revolving-leslie)\
**Post date:** [January 2, 2026, 3:09pm UTC](https://kopia.discourse.group/t/ignore-folder-except-1-subfolder/8758/5 "2026-01-02T15:09:55Z")

</div>

Thanks and fair point re specifics. That’s still not working though. It’s uploading all of AppDate eg: all of of AppData/Local and AppData/LocalLow. I understand it’s using git style exclusions and have used google/chatgpt etc to no avail. Have success with this sort of set up in syncthing, so am wondering if it’s a bug.

---

<div class="post-metadata">

**Author:** ![kapitainsky](https://yyz2.discourse-cdn.com/free1/user_avatar/kopia.discourse.group/kapitainsky/32/535_2.png) [@kapitainsky](https://kopia.discourse.group/u/kapitainsky)\
**Post date:** [January 2, 2026, 3:34pm UTC](https://kopia.discourse.group/t/ignore-folder-except-1-subfolder/8758/6 "2026-01-02T15:34:21Z")

</div>

I created similar dir structure in a temp folder.

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

```

configured exclusions:

```auto
$ 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:

```auto
$ 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:

> [@Backup Exclusion Issue: Specific Directories root drive](https://kopia.discourse.group/t/backup-exclusion-issue-specific-directories-root-drive/2411):
>
> I’m having an issue with setting up exclusions in my backup configuration and would appreciate any assistance. My root directory for the backup is located at D:\ I want to exclude everything from the backup except for the following directories and their subdirectories: D:\Backup\OLD D:\Sys\Docs D:\Data\bd There are multiple files and folders at the root of D:\, as well as within subdirectories, that I want to exclude. For example, I want to exclude files like D:\Backup\list.txt and folders …

---

<div class="post-metadata">

**Author:** ![revolving-leslie](https://yyz2.discourse-cdn.com/free1/user_avatar/kopia.discourse.group/revolving-leslie/32/1936_2.png) [@revolving-leslie](https://kopia.discourse.group/u/revolving-leslie)\
**Post date:** [January 2, 2026, 3:54pm UTC](https://kopia.discourse.group/t/ignore-folder-except-1-subfolder/8758/7 "2026-01-02T15:54:41Z")

</div>

Hey thanks so much for your time helping with this. And we both stumbled across the same answer roughly the same time and you’re right the back/forward slash was the issue! Contrary to what I said previously, forward slashes did work.

So:

```auto
/AppData/Local
/AppData/LocalLow
/AppData/Roaming/*
!/AppData/Roaming/ThisFolder

```

Works…. but unfortunately this leads to the next problem. My plan is to basically ignore my AppData folder but selectively include the configs of various apps that I would like to backup. I thought based on this concept that the following would work:

```auto
/Downloads
/AppData/Local
/AppData/LocalLow
/AppData/Roaming/*
!/AppData/Roaming/ThisFolder1
!/AppData/Roaming/ThisFolder2

```

but I find once I add subsequent folders (eg: ‘ThisFolder2’ onwards) only one sub folder or file of ThisFolder2 is included…

I think I’m on the verge of giving up and either including the whole of AppData with it’s unnecesary bloat or manually backing up the selected AppData folders some other way as this seemed such a simple intention that feels unnecesarily complicated! Appreciate your help tho.

---

<div class="post-metadata">

**Author:** ![kapitainsky](https://yyz2.discourse-cdn.com/free1/user_avatar/kopia.discourse.group/kapitainsky/32/535_2.png) [@kapitainsky](https://kopia.discourse.group/u/kapitainsky)\
**Post date:** [January 2, 2026, 4:00pm UTC](https://kopia.discourse.group/t/ignore-folder-except-1-subfolder/8758/8 "2026-01-02T16:00:04Z")

</div>

> [@revolving-leslie](#):
>
> ```auto
> /Downloads
> /AppData/Local
> /AppData/LocalLow
> /AppData/Roaming/*
> !/AppData/Roaming/ThisFolder1
> !/AppData/Roaming/ThisFolder2
> 
> ```

This is strange.. I use such exclusions (with multiple dirs) all the time.

What is your all exclusion - above looks like snippet only.

Using my test but now with extra folder included:

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

New rules:
/AppData/*
!/AppData/Roaming
/AppData/Roaming/*
!/AppData/Roaming/ThisFolder
!/AppData/Roaming/ThisFolder1

Result:
$ kopia ls -r k97deddc4bee20e7d5bcb9b6909e9b515/AppData
k97deddc4bee20e7d5bcb9b6909e9b515/AppData/Roaming/
k97deddc4bee20e7d5bcb9b6909e9b515/AppData/Roaming/ThisFolder/
k97deddc4bee20e7d5bcb9b6909e9b515/AppData/Roaming/ThisFolder/xxxx/
k97deddc4bee20e7d5bcb9b6909e9b515/AppData/Roaming/ThisFolder/xxxx/gggg.txt
k97deddc4bee20e7d5bcb9b6909e9b515/AppData/Roaming/ThisFolder/ffff.txt
k97deddc4bee20e7d5bcb9b6909e9b515/AppData/Roaming/ThisFolder1/
k97deddc4bee20e7d5bcb9b6909e9b515/AppData/Roaming/ThisFolder1/ooo/
k97deddc4bee20e7d5bcb9b6909e9b515/AppData/Roaming/ThisFolder1/ooo/iii.txt
k97deddc4bee20e7d5bcb9b6909e9b515/AppData/Roaming/ThisFolder1/ccc.txt

```

`ThisFolder` and `ThisFolder1` are included with everything else excluded.

---

<div class="post-metadata">

**Author:** ![revolving-leslie](https://yyz2.discourse-cdn.com/free1/user_avatar/kopia.discourse.group/revolving-leslie/32/1936_2.png) [@revolving-leslie](https://kopia.discourse.group/u/revolving-leslie)\
**Post date:** [January 2, 2026, 11:56pm UTC](https://kopia.discourse.group/t/ignore-folder-except-1-subfolder/8758/9 "2026-01-02T23:56:06Z")

</div>

This is the entire ignore pattern text. I wonder if it’s come from repeated quick snapshots testing varying ignore patterns and maybe there’s some lag in the UI? I’ll keep experimenting. Really appreciate the help - thanks!

---

<div class="post-metadata">

**Author:** ![kapitainsky](https://yyz2.discourse-cdn.com/free1/user_avatar/kopia.discourse.group/kapitainsky/32/535_2.png) [@kapitainsky](https://kopia.discourse.group/u/kapitainsky)\
**Post date:** [January 3, 2026, 2:18am UTC](https://kopia.discourse.group/t/ignore-folder-except-1-subfolder/8758/10 "2026-01-03T02:18:13Z")

</div>

> [@revolving-leslie](#):
>
> ```auto
> /Downloads
> /AppData/Local
> /AppData/LocalLow
> /AppData/Roaming/*
> !/AppData/Roaming/ThisFolder1
> !/AppData/Roaming/ThisFolder2
> 
> ```

is wrong, it should be:

```auto
/Downloads
/AppData/*
!/AppData/Roaming
/AppData/Roaming/*
!/AppData/Roaming/ThisFolder1
!/AppData/Roaming/ThisFolder2

```

assuming that your objective is to include only `/AppData/Roaming/ThisFolder1` and `/AppData/Roaming/ThisFolder2` from `/AppData`. With subfolders inclusions you have to exclude and negate all levels of parent folders’ content.

Not sure why you added:

```auto
/AppData/Local
/AppData/LocalLow

```

If you want to achieve something else than you originally described:

> [@revolving-leslie](#):
>
> ignore the subfolder \AppData except for \AppData\ThisFolder

> [@revolving-leslie](#):
>
> I should probably clarify that the folder I do want is actually in Roaming

> [@revolving-leslie](#):
>
> My plan is to basically ignore my AppData folder but selectively include the configs of various apps that I would like to backup.

then post your full dir tree and explain what needs to be included/excluded.

---

<div class="post-metadata">

**Author:** ![revolving-leslie](https://yyz2.discourse-cdn.com/free1/user_avatar/kopia.discourse.group/revolving-leslie/32/1936_2.png) [@revolving-leslie](https://kopia.discourse.group/u/revolving-leslie)\
**Post date:** [January 4, 2026, 12:36pm UTC](https://kopia.discourse.group/t/ignore-folder-except-1-subfolder/8758/11 "2026-01-04T12:36:04Z")

</div>

Mea culpa! So sorry. After a break from this and a night’s sleep, your pattern works:

```auto
/Downloads
/AppData/*
!/AppData/Roaming
/AppData/Roaming/*
!/AppData/Roaming/ThisFolder1
!/AppData/Roaming/ThisFolder2

```

I was rushing through all these trail and errors which just meant I missed something trying think. Thank you so much @kapitainsky . I need to do some more learning on git type ignore patterns as this isn’t the first time I’ve come unstuck by them!

---

<div class="post-metadata">

**Author:** ![kapitainsky](https://yyz2.discourse-cdn.com/free1/user_avatar/kopia.discourse.group/kapitainsky/32/535_2.png) [@kapitainsky](https://kopia.discourse.group/u/kapitainsky)\
**Post date:** [June 7, 2026, 5:41am UTC](https://kopia.discourse.group/t/ignore-folder-except-1-subfolder/8758/13 "2026-06-07T05:41:03Z")

</div>

@uew93h please stop posting random things all over the place.

You have an issues then create your own thread, post all details etc.

Otherwise nobody can follow.
