How to do actions on files in a folder

Describe the problem/error/question

I am trying to do some actions on every file in a folder using the File Trigger node - however, it only seems to work on one file.

I need to run a series of nodes on each file in the folder as follows:

  1. Get the filename
  2. Open the file based on the filename
  3. Extract the contents of the file
  4. Pass the contents as part of a prompt to a Basic LLM Chain
  5. Output the contents of the LLM response to a new file

When I copy all the files in to the folder being monitored for “File Added” in a Local File Trigger node, it only passes the first file as the output to the next node - I would have expected it to send all the files as a JSON object, so I am a little confused as to why it is not working.

I need to check for some specific things in each file and if they exist, update a report, if they don’t just ignore it and move to the next file in the folder.

Information on your n8n setup

  • n8n version: 1.61.0
  • Database (default: SQLite): SQLite
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): npm
  • Operating system: MacOS

Hey @ThatPrivacyGuy , it doesn’t sound like trigger node is what you need. Did you mean Read/Write Files from Disk?

You can use wildcard character as in

/my_folder/*
1 Like

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