Automate file retrieval from deeply nested Google Drive folders using this robust n8n workflow. Efficiently list all file IDs from a complex directory structure.
Download this n8n workflow template and start using it instantly.
Managing files in Google Drive can be complicated, especially when dealing with deeply nested folder structures. This complex n8n workflow is designed to overcome that limitation by automating the traversal of directories. It provides an elegant solution for aggregating all file identifiers from a root folder, regardless of how many layers of subfolders exist.
This robust n8n workflow utilizes recursion via the Execute Workflow n8n node to ensure all branches of the folder structure are searched. By implementing this detailed logic, you can ensure complete coverage and reliably extract every file ID needed for subsequent operations. This is an essential n8n template for advanced cloud storage automation.
This n8n workflow begins with the Start Execution n8n trigger, initiating the process, typically run manually or called by an external system.
If parent folder has nested folders or not) checks if any sub-folders were found.Start sub-execution n8n node. This recursive pattern ensures that the entire folder tree is mapped. The results are collected and processed by the Get all folder ids Code n8n node, which extracts all relevant folder IDs.Return parent folder id).Loop Over folder ids). This node iterates through every single folder ID.Get all files inside a folder) fetches all files associated with the current folder ID.Return all file ids SET n8n node compiles the final list of file IDs extracted from all folders, providing the comprehensive output of this powerful n8n workflow.To implement this n8n template, follow these steps:
Get children folders from folder id n8n node requires the initial Parent Folder ID to be set in its configuration, likely via a workflow input parameter or a fixed value.Execute Workflow n8n node (Start sub-execution), ensure that the necessary target workflow (likely this same workflow JSON) is active and properly referenced by ID or name in the configuration for the recursive call to function correctly. Start Execution (n8n trigger): Initiates the entire n8n workflow manually or when called by a parent workflow.
Get children folders from folder id (Google Drive n8n node): The primary data source operation. It searches for sub-folders within the designated parent folder ID.
Key Configuration: Operation set to 'Get All' children; Resource set to 'Folder'.
If parent folder has nested folders or not (IF n8n node): Controls the flow, routing execution based on whether the initial Google Drive call returned any sub-folders (checking for nesting).
Start sub-execution (Execute Workflow n8n node): Executes the recursive logic, calling the same n8n workflow to handle deeper nested folders, crucial for traversing the whole directory tree.
Get all folder ids (Code n8n node): Processes the incoming data items (which may include results from recursive calls) to consolidate and return a clean list of all folder IDs found throughout the structure.
Loop Over folder ids (Split In Batches n8n node): Prepares the list of collected folder IDs for sequential processing, ensuring the file extraction is performed on every identified directory.
Get all files inside a folder (Google Drive n8n node): Within the iteration loop, this n8n node retrieves all files contained within the specific folder ID passed by the Split In Batches node.
Key Configuration: Resource set to 'File', Operation set to 'Get All' files, filtering by the parent ID.
Return all file ids (Set n8n node): The final step of the n8n template, used to collect and output the results—the comprehensive list of file IDs.
Automate Google Drive file management using this powerful n8n workflow. Detect, flag, or trash duplicate files based on MD5 checksums and creation time.

Enable AI agents (like Claude or ChatGPT) to read, write, and format Google Docs programmatically using this powerful n8n workflow and MCP server. Leverage the n8n trigger for advanced file operations.

Sync Google Calendar attendees and event RSVP statuses (accepted, declined, canceled) instantly to KlickTipp using this robust n8n workflow. Manage your CRM effortlessly.

Automate document synchronization from Google Drive to a Supabase vector database using n8n. This powerful n8n workflow features custom chunking, OpenAI contextualization, and hybrid RAG search capabilities.

Automate high-quality, SEO-optimized technical blog posts using this robust n8n workflow. Triggers on new Google Sheets submissions, generates content using multiple AI models (Groq, Mistral), optimizes for GEO/SEO, and includes a mandatory human approval gate via a custom n8n form in Gmail.








































