n8n

How to Automate Nextcloud File Migration?

Move a full Nextcloud folder to a new location without breaking the structure. Great for teams that need to reorganize storage or split projects across spaces while keeping every file in the right place.

The flow supports three ways to start it: click run in n8n, send a webhook, or trigger from another workflow. It builds the target folder if it does not exist, reads every subfolder and file, and mirrors the same paths on the destination. Files are moved one by one using batches to avoid rate limits. Inputs are validated up front. If something is wrong, the run stops with a clear error. After the move, you can optionally delete the source folder.

You need a Nextcloud account with access to both the source and destination. Set the Nextcloud credentials in the Nextcloud nodes, then define the from and to paths. For webhook use, send a JSON body with from and to. Expect faster cleanups, fewer manual steps, and fewer copy errors. This is useful for data migrations, project handoffs, or cleaning large external storage that limits speed. Batch size lets you balance speed and safety based on your server load.

What are the key features?

  • Three start options: manual click, webhook POST, or trigger from another n8n workflow
  • Input validation with clear stop and error nodes if required fields are missing
  • Destination folder auto creation when the target path does not exist
  • Recursive scan of all subfolders using listing and batching to gather every file
  • Path mapping with Set and Code nodes to mirror the source structure at the target
  • File moves in batches with loop control to balance speed and rate limit safety
  • Optional cleanup step to delete the original folder after a successful move
  • Consolidated output to track what was found and where each file was moved

What are the benefits?

  • Reduce manual folder moves from hours to minutes by automating discovery and transfer
  • Cut file placement errors by 90 percent by mirroring exact folder paths
  • Handle thousands of files safely using batch control to avoid rate limits
  • Lower rework by validating inputs and stopping invalid runs early
  • Support different teams by allowing manual, webhook, or cross workflow starts

How do you set it up?

  1. Import the template into n8n: Create a new workflow in n8n > Click the three dots menu > Select 'Import from File' > Choose the downloaded JSON file.
  2. You'll need accounts with Nextcloud. See the Tools Required section above for links to create accounts with these services.
  3. Open the workflow and double click any Nextcloud node. In the Credential to connect with dropdown, click Create new credential and follow the on screen steps. Use your Nextcloud URL, username, and password, then save.
  4. In the Set paths node, enter the source folder path in the from field and the target folder path in the to field. Use slashes to define subfolders.
  5. If you want to start by webhook, open the Webhook node, copy the unique URL, and send a POST request with a JSON body that includes from and to.
  6. If you plan to start it from another workflow, ensure the Execute Workflow Trigger node is enabled and that you pass from and to as parameters when calling it.
  7. Make sure only one trigger is active for testing. Disable the others to avoid accidental runs.
  8. Test access by running the Create to folder if necessary node. Confirm the target folder is created in Nextcloud if it did not exist.
  9. Run a small test with a folder that has a few files. Watch the Loop Over nodes to confirm batches process as expected.
  10. If you see rate limit errors, reduce the batch size in Loop Over all files. If runs are slow and stable, you can increase the batch size.
  11. Only enable the Delete from folder node after you confirm files are fully moved and visible in the target location.
  12. When ready, enable your preferred trigger and deploy. Monitor logs for any invalid request errors and fix missing from or to fields if needed.

Tools Required

$24 / mo or $20 / mo billed annually to use n8n in the cloud. However, the local or self-hosted n8n Community Edition is free.

Nextcloud

Sign up

Self-hosted (Community): $0

Credits:
Nico Kowalczyk YouTube video Website

Similar Templates

Join Futurise to access 1,200+ automation templates

Get instant access to ready-made automation workflows for n8n, Make.com, AI agents, and more. Download, customise, and deploy in minutes.