Debounce logic in local-file-trigger

Describe the problem/error/question

When I tried this AI workflow template on my local machine, I had the problem that three files pasted simultaneously into the target folder would trigger three times.

I think an option would be useful to debounce the files added (if that is possible), so that all of the files pasted there at once also trigger together and only once.

I might need to adjust the workflow template to handle this better, but just thought it’s quite normal to copy paste multiple files around.

Current result is the workflow triggers 3 times, I get three errors, but the files get moved, and then I get three new triggers cause the files moved and those are successful, bc it stops at the if node. Max Folder Depth = Top Folder Only should fix the unnecessary three successful executions, but the other one not sure. Like this I’m using more AI tokens than necessary…

If I process one file at a time it should be easy to fix, if sb has an idea, I’d be curious to hear it!

What is the error message (if any)?

Please share your workflow

Share the output returned by the last node

Information on your n8n setup

  • n8n version: 1.56.2
  • Database (default: SQLite): SQLite
  • n8n EXECUTIONS_PROCESS setting (default: own, main): main
  • Running n8n via (Docker, npm, n8n cloud, desktop app): npm
  • Operating system: Mac OS 14.3

Organise Your Local File Directories With AI - Template

I have fixed the template so that it works as I would expect.

Here are the changes, I’ve also updated all the notes in the workflow below to be accurate:

Modified

Original template from Jimleuk
→ tried it, needed some adjustments to work properly

  • spaces in file / folder names would error
  • dropping multiple files in the target folder wouldn’t behave as expected
  • moved files would in turn trigger the automation, which made executions a mess

→ now every added file executes the workflow, also if you add 5 at once
→ every file gets a suggested location
→ now it works as expected!

Thanks Jimleuk for the initial work and sharing the template! Hope this helps some of you :slight_smile:

Like I said, thanks @jimleuk for the template! Probably your version works well for your setup, I just thought I’d share my updated version in case somebody else is having similar issues with it!

3 Likes

Hi @leprodude

That is awesome! Thank you for sharing :slight_smile:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.