Issue with loop on folders

I have an issue I cannot figure out. New to how n8n processes files and not grasping what I need here. I have a flow that reads the folders from FTP. If the folder matches a name, then it is sent on to the next step. This step should read all the folder paths, then read the files from each folder. I am getting stuck at the step between the IF and the Read Files. It only processes one folder.

It looks like your topic is missing some important information. Could you provide the following if applicable.

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

I am not sure about this exact information. N8N should be at the most recent version. Its running on Docker.

Hi @Lee_Booker, welcome to the community!

I am sorry you are having trouble. I have tried reproducing this on n8n 1.24.1 using the following data structure:

/sftp
  /folder_01
    guzman-barquin-x3yEuPLTFPU-unsplash.jpg
/sftp
  /folder_02
    jack-cohen-QUcTEQWZpNs-unsplash.jpg

So two folders with one file in each. I have then executed the below workflow:

n8n returns files from both folders. It also works when there is more than one file in a folder, the result looks like so:

Perhaps you can confirm how your SFTP content actually looks like, which data you are getting from your IF Folder Matches node, and which result you are seeing on your Read Files node?

It would also be great if you could copy your actual workflow content. Simply select it on your canvas and press Ctrl+C, then insert it using Ctrl+V here on the forum. This way, I can take a look at the settings of each node. You can, of course, redact anything confidential before posting here on the forum.

Thank you!