Google Drive Folder Structure Cloner - n8n Workflow

Use this custom n8n workflow to clone nested folder structures in Google Drive automatically. Ideal for project template creation and bulk operations.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Project managers who need to rapidly spin up new project folders based on a standard template.

  • IT administrators or operations teams managing large, standardized filing systems.

  • Users looking for advanced Google Drive automation beyond standard integration features, utilizing the HTTP Request n8n node.

  • Anyone seeking robust n8n templates for cloud storage management.

Overview

Manually recreating deeply nested folder structures in Google Drive is time-consuming and error-prone. This specialized n8n workflow solves this by providing a reliable, automated solution. This n8n template is essential for organizations that rely on standardized document hierarchy for various projects, clients, or departments. The automation leverages the generic HTTP Request n8n node to interact directly with the Google Drive API, giving maximum control over the creation process, including the application of custom prefixes or suffixes defined in the configuration. Implementing this powerful n8n workflow simplifies project setup and ensures consistency across all your digital assets.

How it Works

This comprehensive n8n workflow operates in a sequential, highly customized manner to ensure accurate folder replication.


  1. Trigger and Configuration: The process starts with a manual n8n trigger ('When clicking "Test workflow"'). The subsequent 'CONFIG' n8n node uses custom code to initialize crucial variables, such as the sourceFolderId and the targetParentFolderId for the new structure.

  2. Data Retrieval: The 'Get All Folders' n8n node (configured as an HTTP Request) calls the Google Drive API to recursively list all folders within the source directory.

  3. Hierarchy Reconstruction: The core logic resides in the 'Process Folders' n8n node. This custom code takes the flat list of retrieved metadata and computationally reconstructs the nested hierarchy, applying necessary path adjustments and the custom naming scheme defined in the configuration.

  4. Conditional Creation: The 'Should Create?' n8n node acts as a conditional filter, checking the output of the processor to ensure only valid, required folders are passed forward for creation.

  5. Folder Creation: If the condition is met, the 'Create Folder' n8n node (HTTP Request) executes the API call to create the new folder within the specified target parent folder, respecting the calculated nested path and custom name.

  6. Reporting: Finally, the 'Final Report' n8n node summarizes the overall operation, detailing successful creations and any issues encountered during the execution of this n8n template.

Installation Guide

To set up this n8n workflow, follow these steps:


  1. Import: Copy the provided n8n JSON code and import it into your n8n instance as a new workflow.

  2. Google Drive Credentials: Since this n8n workflow uses the HTTP Request n8n node for direct API interaction, you will need valid Google Drive credentials set up that allow file manipulation. Ensure these credentials are configured for use with the HTTP Request node, often requiring OAuth2 configuration for service accounts or end-user access.

  3. Configuration: Access the 'โš™๏ธ CONFIG - Edit the 3 variables above' Code n8n node.

- Edit the code to define the actual Google Drive IDs for your source folder (the template) and the parent folder where the new structure should be placed.
- Adjust the custom naming logic (prefix/suffix) within this n8n node as required.

  1. Testing: Save the n8n workflow and click the 'Test workflow' button (the manual n8n trigger) to verify functionality before running in a production environment.

Node Details

This n8n workflow relies on several specific n8n node types for its functionality:

When clicking "Test workflow" (Manual Trigger): The initiating n8n trigger, used to manually start the cloning process.
โš™๏ธ CONFIG (Code n8n node): Function: Initializes crucial variables like Source Folder ID, Target Parent ID, and any custom naming strings needed for the folder replication.
๐Ÿ“ Get All Folders (HTTP Request n8n node): Function: Queries the Google Drive API's files endpoint to retrieve a recursive list of all folder metadata starting from the defined source folder ID.
๐Ÿ”„ Process Folders (Code n8n node): Function: The core logic node. It processes the flat API response, calculates the new relative paths, determines the necessary parent IDs, and applies custom naming conventions for the copied folders.
๐Ÿ”€ Should Create? (If n8n node): Function: Acts as a flow control mechanism, ensuring only items identified as folders that need creation are passed to the next step. This crucial n8n node maintains workflow integrity.
โœจ Create Folder (HTTP Request n8n node): Function: Executes the final Google Drive API call (POST request) to create the new folder using the modified name and the dynamically determined new parent folder ID. This n8n node executes the core action.


  • ๐Ÿ“Š Final Report (Code n8n node): Function: Gathers results from the successful folder creations and outputs a summary of the operation for verification.

Related n8n Workflows

Free

Nodes: 5 Nodes
Updated: December 26 2025
View all
Created by
Jagged Frontiersman
Jagged Frontiersman

Featured*