Get all files of subfolders
Configured with Execute Workflow Trigger, Next Cloud, Loop Over Items, Stop And Error, and additional nodes. Review the connections and setup before adapting this template.
Node categories in this workflow
- Trigger
- Routing
- Transform
- Code
- Integration
Icons describe general node roles, inferred from node types. Inspect the parameters for the configured action.
Drag to pan; use + and − to zoom. Reconstructed from the exported node positions; nothing runs here. Dashed lines represent non-main connections. Full node names and notes appear below.
How it works
The exported workflow contains the following configured nodes. Their connections are shown above; inspect the JSON for the complete logic, expressions, and external actions.
| Node | Category | Type | Operation |
|---|---|---|---|
| When clicking "Execute Workflow" | Trigger | Manual Trigger | See node parameters |
| Whether type is file | Routing | If | See node parameters |
| Set new path for subfolder | Transform | Edit Fields | See node parameters |
| Set new path for file | Code | Code | See node parameters |
| Webhook | Trigger | Webhook | See node parameters |
| Execute Workflow Trigger | Trigger | Execute Workflow Trigger | See node parameters |
| Set folder-paths for from and to | Transform | Edit Fields | See node parameters |
| Create to folder if necessary | Integration | Next Cloud | folder |
| Get all folders/files in from-folder | Integration | Next Cloud | folder / list |
| Loop over files and folders | Routing | Loop Over Items | See node parameters |
| Consolidate all files and folders found | Routing | No Op | See node parameters |
| Create subfolder in to-folder | Integration | Next Cloud | folder |
| Get all folders/files in found subfolder | Integration | Next Cloud | folder / list |
| Whether there is are more files or subfolders found | Routing | If | See node parameters |
| Consolidate all found files | Code | Code | See node parameters |
| Loop Over all files | Routing | Loop Over Items | See node parameters |
| Move file to destination | Integration | Next Cloud | move |
| Delete from-folder | Integration | Next Cloud | folder / delete |
| Set paths | Transform | Edit Fields | See node parameters |
| Whether the request is valid | Routing | If | See node parameters |
| Stop and Error: request not valid | Routing | Stop And Error | See node parameters |
| Whether the request is valid1 | Routing | If | See node parameters |
| Stop and Error: request not valid1 | Routing | Stop And Error | See node parameters |
Setup
- Download the JSON and import it into an isolated n8n instance. Leave the workflow inactive.
- Connect your own credentials through n8n’s credential store. Replace
REPLACE_WITH_*values with your resource identifiers. - Inspect API destinations, Code nodes, database queries, file paths, and outbound actions.
- Run with synthetic data and harmless destinations. Enable triggers only after checking the actual outputs.
Requirements
An n8n instance with the listed node types and compatible versions. Service-connected workflows may require accounts, credentials, or paid APIs.
Credential types declared in the source
nextCloudApi
Workflow notes
Get all files of subfolders
Get all files of subfolders
In this segment of the workflow, all files located within subfolders are collected. This includes the exploration of subfolders within subfolders, ensuring the identification of every file throughout the entire folder structure. Additionally, a corresponding folder is created in the destination structure for each identified subfolder.
Enrich the files
Enrich the files
In this phase of the workflow, all identified files are processed and enriched with the correct path within the destination structure.
Move files
Move files
In this stage of the workflow, the files are moved into the destination structure.
If the batch size remains at 1 in the Loop Over node, each file will be moved sequentially. If the batch size is increased, multiple files will be moved simultaneously.
Get the files and subfolders to move
Get the files and subfolders to move
In this segment of the workflow, all files and subfolders to be relocated are gathered. Additionally, the destination folder is created if it does not already exist.
Manual Start
Manual Start
To manually initiate the workflow, the Set Paths node requires the specification of the folder path to be moved and the destination folder path. Subfolders can be indicated using '/'.
Ensure that the other workflow triggers are deactivated before initiating the workflow.
Webhook trigger
Webhook trigger
You can also automate the workflow by configuring a webhook to trigger it. It is crucial that each request contains a JSON body with at least the two attributes 'from-path' and 'to-path' set. Here is an example:
{
"from": "Folder/to/move",
"to": "New-Folder"
}
The workflow will respond with an error, if the request is not valid.
Ensure that the other workflow triggers are deactivated before initiating the workflow.
Trigger by other workflow
Trigger by other workflow
It is also possible to initiate this workflow from within another workflow. It is important to ensure that at least the 'from-path' and 'to-path' are passed as parameters when starting this workflow.
The workflow will respond with an error, if the request is not valid.
Ensure that the other workflow triggers are deactivated before initiating the workflow.
Template Description
Template Description
Description:
This template facilitates the transfer of a folder, along with all its files and subfolders, within a Nextcloud instance. The Nextcloud user must have access to both the source and destination folders. While Nextcloud allows folder movement, complications may arise when dealing with external storage that has rate limits. This workflow ensures the individual transfer of each file to avoid exceeding rate limits, particularly useful for setups involving external storage with rate limitations.
How it works:
- Identify all files and subfolders within the specified source folder.
- Recursive search within subfolders for additional files.
- Replicate the folder structure in the target folder.
- Individually move each identified file to the corresponding location in the target folder.
Set up steps:
- Set Nextcloud credentials for all Nextcloud nodes involved in the process. -Edit the trigger settings. Detailed instructions can be found within the respective trigger configuration.
- Initiate the workflow to commence the folder transfer process.
Help
If you need assistance with applying this template, feel free to reach out to me. You can find additional information about me and my services here. => https://nicokowalczyk.de/links
I have also produced a video where I explain the workflow and provide an example. You can find this video over here. https://youtu.be/K1kmG_Q_jRk
Cheers. Nico Kowalczyk
Get all files of subfolders
Get all files of subfolders
Purpose and structure
This folder contains the Get all files of subfolders workflow. Its executable nodes use code, executeWorkflowTrigger, if, manualTrigger, nextCloud, noOp, set, splitInBatches, stopAndError, webhook. The table and connection map below are derived from the JSON, not an inferred guarantee of behavior.
Setup
Import inactive. Configure your own credentials and replace REPLACE_WITH_* values. Review external destinations and Code nodes before running.
Entry points
When clicking "Execute Workflow", Webhook, Execute Workflow Trigger
Verification
Sanitized source candidate; not runtime-tested. This overview is generated from node metadata. Read the folder README for the connection map, credential types, and license.
Attribution
https://github.com/Zie619/n8n-workflows/blob/94007c1445d9258a7da116646b79473e7c7c3282/workflows/Stopanderror/0333_Stopanderror_Webhook_Create_Webhook.json MIT; preserve source notices.
Canvas section labels
These name areas of the original canvas; they do not include explanatory instructions.
- (Optional) Delete *from*-folder