# What is the use case for folder actions? How to use them correctly?

**URL:** https://kopia.discourse.group/t/what-is-the-use-case-for-folder-actions-how-to-use-them-correctly/3424
**Category:** Support
**Created:** [November 8, 2024, 3:07pm UTC](https://kopia.discourse.group/t/what-is-the-use-case-for-folder-actions-how-to-use-them-correctly/3424 "2024-11-08T15:07:57Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![andz](https://avatars.discourse-cdn.com/v4/letter/a/ebca7d/32.png) [@andz](https://kopia.discourse.group/u/andz)
#### Post date: [November 8, 2024, 3:07pm UTC](https://kopia.discourse.group/t/what-is-the-use-case-for-folder-actions-how-to-use-them-correctly/3424/1 "2024-11-08T15:07:57Z")

</div>

Hi everybody.

First of all, I am using the web interface.

I feel a bit lost here. What is the use case for folder actions? How to use them correctly?

Let’s assume I have the following directory I want to backup:

```plaintext
/data/
  --.kopiaignore
  --documents/
       --stuff-i-want-to-ignore/
         -ignore-me-a.txt
         -ignore-me-b.txt
	--a.txt
	--b.txt
	--c.txt
  --pictures/
       --stuff-i-want-to-ignore/
         -ignore-me-1.jpg
         -ignore-me-2.jpg
	--1.jpg
	--2.jpg
	--3.jpg

```

`.kopiaignore` file content:

```plaintext
/documents/stuff-i-want-to-ignore/
/pictures/stuff-i-want-to-ignore/

```

If I a define a before-snapshot action and a before-folder action in the `/data` path policy, both actions are being executed exactly once with `KOPIA_SOURCE_PATH=/data`.

I would expect/hope that the before-folder action would be called for each [“individual folder”](https://kopia.io/docs/advanced/actions/#actions):

- `/data`
- `/data/documents`
- `/data/pictures`

That way I could perform preparation tasks depending on the subdirectory that is being backed up.

If I create a new policy with target path `/data/documents` and add a before-folder action, it will be executed when backing up `/data`. But this also creates a new snapshot for `/data/documents`, including `/documents/stuff-i-want-to-ignore/*` in the backed up files, since the `kopiaignore` file is located in the root directory `/data`.

This doesn’t seem right to me. Why can’t I have a policy for `/data/documents` **without** having a corresponding snapshot?
