Google Drive Folder Structure Replication Utility - n8n Workflow

Replicate Google Drive folder structures quickly using this powerful n8n workflow. Use this n8n template to copy folder hierarchies without files, ideal for new project setups.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Project managers needing to standardize folder setups across multiple clients or projects.

  • IT administrators automating document structure deployment.

  • Teams looking for robust n8n templates to handle cloud storage synchronization tasks.

  • Users who frequently clone folder templates but want to leave files behind.

Overview

Manually recreating complex folder structures in Google Drive is tedious and error-prone. This specialized n8n workflow solves that problem by automatically identifying the hierarchy of folders in a source location and recreating them in a designated destination folder. Unlike standard copying methods, this n8n workflow ensures that only the structural elements are transferred, saving time, bandwidth, and ensuring the destination folder starts clean. This particular n8n workflow uses robust core logic to check for existing folders before creation, preventing duplicates and ensuring idempotent execution. It is one of the most useful n8n templates for cloud storage management.

How it Works

The process begins with a manual n8n trigger, allowing the user to initiate the replication on demand.


  1. Initialization: The n8n workflow starts at the EDITTHISNODE (a Set n8n node) where the user defines the IDs for the Source and Destination parent folders.

  2. Destination Context Retrieval: The workflow first queries the destination folder using the Google Drive n8n node (GetFoldersDESTINATION) to understand the current structure or if it is empty.

  3. Source Structure Retrieval: Next, the Google Drive n8n node (GetFoldersSOURCE) recursively retrieves the entire folder structure (name, ID, parent IDs) from the specified source folder.

  4. Iteration: The Loop Over Items n8n node then processes each retrieved folder individually.

  5. Existence Check: For every folder, a Code n8n node (Check if folder exists) executes custom logic to determine if a folder with the identical name already exists within the corresponding location in the destination structure. This ensures the n8n template is efficient and avoids API throttling.

  6. Conditional Creation: An If n8n node (If exists) evaluates the check. If the folder does not exist, the flow proceeds to the final step.

  7. Folder Creation: The Google Drive n8n node (Create Folder) creates the new folder in the target destination, ensuring the full hierarchical path is maintained based on the source metadata. The n8n workflow then loops back to process the next item until the entire source structure is replicated.

Installation Guide

To use this n8n workflow, follow these steps:


  1. Import: Copy the provided JSON data and import it into your n8n instance using the 'Import Workflow' function.

  2. Credentials: You will need to set up Google Drive credentials. Click on any Google Drive n8n node (e.g., GetFoldersSOURCE) and connect it to your Google account.

  3. Configuration (Crucial Step): Locate the EDITTHISNODE (Set n8n node). You must edit its parameters to define the Google Drive IDs for:

sourcefolderid: The ID of the folder you wish to copy the structure from.
destinationfolderid: The ID of the parent folder where the new structure will be created.

  1. Activate and Test: Activate the n8n workflow. Use the 'Test workflow' button on the When clicking ‘Test workflow’ n8n trigger to run a test execution. Once verified, you can set up a scheduled n8n trigger if desired, though this template is best suited for manual execution.

Node Details

When clicking ‘Test workflow’ (Manual Trigger): Serves as the initial n8n trigger to manually start the process. Essential for testing and on-demand use.
EDITTHISNODE (Set n8n node): Critical configuration step. Used to securely define and pass the sourcefolderid and destinationfolderid for the Google Drive operations.
GetFoldersDESTINATION & GetFoldersSOURCE (Google Drive n8n node): These nodes utilize the Google Drive API to recursively list all folders (but not files) within the defined source and destination paths, gathering the necessary metadata for replication.
Loop Over Items (Split In Batches n8n node): This flow control n8n node iterates through the list of folders retrieved from the source, allowing subsequent nodes to process each folder path individually.
Check if folder exists (Code n8n node): A custom n8n node implementing specific JavaScript logic to compare the incoming folder path against the existing destination paths to prevent the creation of duplicate folders. This is key to the workflow's reliability.
If exists (If n8n node): Directs the flow based on the output of the Code n8n node. Only if the folder does not exist does the flow continue to the creation step.


  • Create Folder (Google Drive n8n node): The final action n8n node. It uses the input data to create the missing folder in the correct relative location within the Google Drive destination folder.

Related n8n Workflows

Paid

Nodes: 8 Nodes
Updated: December 26 2025
View all
Created by

Featured*