Anymatch in local file trigger

Hi! I’m using n8n to detect changes in a local directory and I would like to use the Local File Trigger node with the ‘Ignore’ option and the anymatch syntax but don’t know how and the documentation doesn’t explain much about this. Anybody could help pls?

Thank you!

Hi @jpestana, welcome the community!

Tbh, after reading this page (linked in the platform when hovering over the question mark of the Ignore field) I’ve got no clue either I am afraid :frowning:

What exactly would you like to ignore? Perhaps we can figure this out.

I think I’ve figured this out —

Have a look at the first example in this section: Anymatch in local file trigger

Now imagine your job is to write some Javascript code that generates the matchers object.

If you switched the “Ignore” entry field from Fixed to Expression, you can then type in some Javascript that would generate the relevant matchers object. (In your mind’s eye, just imagine that n8n is calling anymatch(matchers, <path>) for you on every ingested file.)

So here’s an example of the “Ignore” field (Expression mode) from my setup, which seems to work:

{{ ['**/*.js', '.DS_Store', '**/.DS_Store', '.obsidian/plugins/text-extractor/cache', '.obsidian/plugins/text-extractor/cache/*', '.obsidian/plugins/text-extractor/cache/**/*'] }}