Ruriko
April 19, 2025, 9:02am
1
Describe the problem/error/question
I want to create a list of subfolders in a directory. I can see that the Read Files node can list files but it can’t list subfolders. Is there a node that can list subfolders?
What is the error message (if any)?
Please share your workflow
(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)
Share the output returned by the last node
Information on your n8n setup
**n8n version:**1.83.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,
in worst cast you could do an “execute command” and list all the directories based on your OS.
The best would be to find a tool or CLI command that can output in a reasonable format so the subsequent parsing step would be easy.
reg,
J.
Hi @Ruriko , take a look at this solution, it might work for you.
Hi,
I am a dev new to n8n and here is my first workflow to solve one problem : the google drive api does not recursively give you all subfolders, you need to orchestrate several api calls to have all subfolders.
This workflow lets you make a webhook call with the id, and you get a list of all subfolders ids.
I have two objectives with this post:
share it since it seems to be a shared problem not solved in n8n after a few searches
Understand what I did wrong designing my workflow because thi…
Ruriko
April 20, 2025, 12:59am
4
So i’m using the execute command node but I don’t know how to transfer the data to n8n to output as json. How can I do this?
Ruriko
April 20, 2025, 1:00am
5
Can’t use that method since that only works for remote filesystem where as I want to do it on a local filesystem
1 Like
Hi,
I’ve created a slightly modified example.
The output is available through linux-style naming (stdout)
I’ve changed the dir command to be recursive so it fetches all the directories.
If you need to have only the relative paths, you will need to use a code node to transform it.
Please accept as a solution if it solved your problem.
regards,
J.
1 Like
system
Closed
April 27, 2025, 6:04am
7
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.