# How to ignore directories?

**URL:** <https://kopia.discourse.group/t/how-to-ignore-directories/497>\
**Category:** Support\
**Created:** [June 26, 2021, 12:14pm UTC](https://kopia.discourse.group/t/how-to-ignore-directories/497 "2021-06-26T12:14:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dsfhfghdfgsgfdsg](https://avatars.discourse-cdn.com/v4/letter/d/ce73a5/32.png) [@dsfhfghdfgsgfdsg](https://kopia.discourse.group/u/dsfhfghdfgsgfdsg)\
**Post date:** [June 26, 2021, 12:14pm UTC](https://kopia.discourse.group/t/how-to-ignore-directories/497/1 "2021-06-26T12:14:54Z")

</div>

I’ve read this : [Issue with file/folder ignore rules - #5 by maclm](https://kopia.discourse.group/t/issue-with-file-folder-ignore-rules/96/5)

I try to ignore every folders named “.cache” but i don’t understand how the ignore policy work. Here are the policies of my repo :

```auto
  "files": {
    "ignore": [
      "**/.cache",
      "**/.cache/",
      "**/.cache/*",
      " **/.cache/**",
      "*/.cache",
      "*/.cache/",
      "*/.cache/*",
      "*/.cache/**",
      ".cache",
      ".cache/",
      ".cache/*",
      ".cache/**",
      "**/cache",
      "**/cache/",
      "**/cache/*",
      " **/cache/**",
      "*/cache",
      "*/cache/",
      "*/cache/*",
      "*/cache/**",
      "cache",
      "cache/",
      "cache/*",
      "cache/**"
    ],
    "ignoreDotFiles": [
      "**/.cache",
      "**/.cache/",
      "**/.cache/*",
      " **/.cache/**",
      "*/.cache",
      "*/.cache/",
      "*/.cache/*",
      "*/.cache/**",
      ".cache",
      ".cache/",
      ".cache/*",
      ".cache/**",
      "**/cache",
      "**/cache/",
      "**/cache/*",
      " **/cache/**",
      "*/cache",
      "*/cache/",
      "*/cache/*",
      "*/cache/**",
      "cache",
      "cache/",
      "cache/*",
      "cache/**"
    ]
  },

```

But when I run `kopia snapshot estimate` I still see that my “.cache” folder are backuped :

```auto
$ kopia snapshot estimate /home/me/
Analyzing ....
Analyzing .cache...
Analyzing .cache/pip...
Analyzing .cache/pip/http...
Analyzing .cache/pip/http/0...
[...]
Snapshots excludes no files.
Snapshots excludes no directories.

```

How to ignore a folder by its name ?

---

<div class="post-metadata">

**Author:** ![dsfhfghdfgsgfdsg](https://avatars.discourse-cdn.com/v4/letter/d/ce73a5/32.png) [@dsfhfghdfgsgfdsg](https://kopia.discourse.group/u/dsfhfghdfgsgfdsg)\
**Post date:** [June 26, 2021, 12:34pm UTC](https://kopia.discourse.group/t/how-to-ignore-directories/497/2 "2021-06-26T12:34:36Z")

</div>

Oh i think i understand, i thought that global policies were common across all repositories and that the path you use at the end of “kopia policy set [opt] path” was the path of the repository you want to update.

But instead it looks like global policies are policies local to a repository, and the path is for creating policies for a specific folder inside a repository.

Or something like that, i’m not sure i understand how kopia works.

---

<div class="post-metadata">

**Author:** ![jkowalski](https://yyz2.discourse-cdn.com/free1/user_avatar/kopia.discourse.group/jkowalski/32/3_2.png) [@jkowalski](https://kopia.discourse.group/u/jkowalski)\
**Post date:** [June 26, 2021, 3:20pm UTC](https://kopia.discourse.group/t/how-to-ignore-directories/497/3 "2021-06-26T15:20:52Z")

</div>

I think it should be sufficient to set a `global` policy which excludes `.cache` and `cache`.

```auto
kopia policy set --global --add-ignore .cache --add-ignore cache

```

If you only want to exclude caches under a specific directory do:

```auto
kopia policy set /path/to/some/dir --add-ignore .cache --add-ignore cache

```

All ignore rules are inherited from their parents and global is the ultimate parent. When you do that, it will look for `.cache` and `cache` when snapshotting any directory (under global, so all of them) and ignore them. In general there’s usually no need to mess with wildcards or “/”.

---

<div class="post-metadata">

**Author:** ![dsfhfghdfgsgfdsg](https://avatars.discourse-cdn.com/v4/letter/d/ce73a5/32.png) [@dsfhfghdfgsgfdsg](https://kopia.discourse.group/u/dsfhfghdfgsgfdsg)\
**Post date:** [June 27, 2021, 8:05am UTC](https://kopia.discourse.group/t/how-to-ignore-directories/497/4 "2021-06-27T08:05:29Z")

</div>

Thanks, after playing with it a bit I understand better how it works.
