How to upload only the first 4 files?

Describe the problem/error/question

I created a workflow that reads zip file that contains multiple files in it. It extracts the zip and then split binary files into items and lastly it’ll upload the files to the image host. What I want to do is only upload the first 4 files instead of all files. How can I do this?

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.89.2
  • **Database (default: SQLite):default
  • **n8n EXECUTIONS_PROCESS setting (default: own, main):default
  • **Running n8n via (Docker, npm, n8n cloud, desktop app):npm
  • **Operating system:Windows Server 2022

Hi,

You could use a counter and a break statement to stop the for loop inside of the code block.

reg,
J.

can you show me an example workflow?

Hi,

It’s very simplistic but it shows how it can be done.

I’m not editing yours since i don’t have the valid data.

1 Like

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