{
  "name": "Google Drive workflow with nested folder support",
  "nodes": [
    {
      "id": "7ad58632-aaae-49d1-8a4d-192696ea5fbe",
      "name": "If parent folder has no folder",
      "type": "n8n-nodes-base.if",
      "position": [
        720,
        224
      ]
    },
    {
      "id": "e295dc16-bee6-4c2d-a1c4-275c093ee98a",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -224,
        -304
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "306a72d8-17cb-491e-ab71-563d67033dc4",
      "name": "If parent folder has nested folders or not",
      "type": "n8n-nodes-base.if",
      "position": [
        464,
        96
      ]
    },
    {
      "id": "c7066d3c-db7e-4d10-8ea7-844f4a7f92b5",
      "name": "Start Execution",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        -16,
        96
      ]
    },
    {
      "id": "37ad0017-a81e-4142-a699-5979917d3e3e",
      "name": "Get all folder ids",
      "type": "n8n-nodes-base.code",
      "position": [
        928,
        -32
      ]
    },
    {
      "id": "f395e3b0-4010-4ce6-b9e4-d40c38eaf6e2",
      "name": "Return parent folder id",
      "type": "n8n-nodes-base.set",
      "position": [
        928,
        144
      ]
    },
    {
      "id": "69349d16-147a-4a53-921f-2afbce976421",
      "name": "Return parent folder id to sub-workflow",
      "type": "n8n-nodes-base.set",
      "position": [
        928,
        304
      ]
    },
    {
      "id": "cc185a48-6793-4dea-ab4b-1a4227391552",
      "name": "Start sub-execution",
      "type": "n8n-nodes-base.executeWorkflow",
      "position": [
        720,
        -32
      ]
    },
    {
      "id": "97895244-0065-4aa8-b200-87782f6bcf8c",
      "name": "Get children folders from folder id",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        240,
        96
      ]
    },
    {
      "id": "9df3e103-c7a7-41dc-a5e0-0b77b4959a93",
      "name": "Loop Over folder ids",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        1600,
        -32
      ]
    },
    {
      "id": "15f2bc5a-0c2f-45f8-b7dc-b4775641f6c1",
      "name": "Get all files inside a folder",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1856,
        192
      ]
    },
    {
      "id": "1fe7e380-e5a2-422d-a91f-3c9382fadedf",
      "name": "Return all file ids",
      "type": "n8n-nodes-base.set",
      "position": [
        1856,
        -48
      ]
    },
    {
      "id": "c9b24b37-9745-4e4d-b9bc-895765c0b210",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -64,
        -128
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "fe94e670-7de0-42ce-889b-d755b4edb5bf",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1424,
        -128
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    }
  ],
  "connections": {
    "Start Execution": {
      "main": [
        [
          {
            "node": "Get children folders from folder id",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get all folder ids": {
      "main": [
        [
          {
            "node": "Loop Over folder ids",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Start sub-execution": {
      "main": [
        [
          {
            "node": "Get all folder ids",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over folder ids": {
      "main": [
        [
          {
            "node": "Return all file ids",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get all files inside a folder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Return parent folder id": {
      "main": [
        [
          {
            "node": "Loop Over folder ids",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get all files inside a folder": {
      "main": [
        [
          {
            "node": "Loop Over folder ids",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If parent folder has no folder": {
      "main": [
        [
          {
            "node": "Return parent folder id",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Return parent folder id to sub-workflow",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get children folders from folder id": {
      "main": [
        [
          {
            "node": "If parent folder has nested folders or not",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Return parent folder id to sub-workflow": {
      "main": [
        []
      ]
    },
    "If parent folder has nested folders or not": {
      "main": [
        [
          {
            "node": "Start sub-execution",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "If parent folder has no folder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}