{
  "name": "Automação de Backup | Aula",
  "nodes": [
    {
      "parameters": {
        "content": "# Criação da Pasta no Drive",
        "height": 480,
        "width": 260,
        "color": 4
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -140,
        -80
      ],
      "id": "f3a7198b-8396-46bc-b39d-86155a6c1629",
      "name": "Sticky Note3"
    },
    {
      "parameters": {
        "content": "# Busca e Conversão das Automações\n\n",
        "height": 480,
        "width": 440
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        140,
        -80
      ],
      "id": "ad9776c0-1317-40a5-88c8-443474a67d6c",
      "name": "Sticky Note4"
    },
    {
      "parameters": {
        "content": "  # Upload no Google Drive\n",
        "height": 480,
        "width": 280,
        "color": 5
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        600,
        -80
      ],
      "id": "93b24dd4-f80b-438f-86a1-7b40c54ee49f",
      "name": "Sticky Note5"
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        -1040,
        200
      ],
      "id": "3f9eb4ab-51d6-4081-b2d6-dacdb23481f9",
      "name": "Schedule Trigger"
    },
    {
      "parameters": {
        "resource": "folder",
        "name": "=Backup N8N - {{ $now.format('dd-MM-yyyy') }}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "folderId": {
          "__rl": true,
          "value": "19SQ5L5yW5Qnwp8BGh2r46uKdx2_JRiNP",
          "mode": "list",
          "cachedResultName": "N8N - BACKUP ",
          "cachedResultUrl": "https://drive.google.com/drive/folders/19SQ5L5yW5Qnwp8BGh2r46uKdx2_JRiNP"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [
        -60,
        220
      ],
      "id": "60927515-bd58-44e9-8de3-f6bf77699bde",
      "name": "Criar pasta",
      "executeOnce": true,
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "Igcs9JkgzmibbwCV",
          "name": "Drive - Cyborgs Edu"
        }
      }
    },
    {
      "parameters": {
        "operation": "deleteFile",
        "fileId": {
          "__rl": true,
          "value": "={{ $json.id }}",
          "mode": "id"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [
        -320,
        60
      ],
      "id": "7e958f25-79f3-4684-865f-1b8283d0c28f",
      "name": "Deletar pasta",
      "alwaysOutputData": true,
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "MHIHC3Qsp3lRROEN",
          "name": "Google Drive - Transcrever Audio"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "7f8e6eed-809f-48b2-8433-5ab849cc4a80",
              "leftValue": "={{ $json.name }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        -540,
        200
      ],
      "id": "90237e17-acef-49cf-bf72-32c24515e40a",
      "name": "Pasta Existe"
    },
    {
      "parameters": {
        "content": "# Verificação\n",
        "height": 480,
        "width": 680,
        "color": 6
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -840,
        -80
      ],
      "id": "7a265171-80f2-4336-a8ef-62cba2e66035",
      "name": "Sticky Note"
    },
    {
      "parameters": {
        "filters": {},
        "requestOptions": {}
      },
      "type": "n8n-nodes-base.n8n",
      "typeVersion": 1,
      "position": [
        220,
        220
      ],
      "id": "43d4706e-95dd-4cee-8a87-e8193f1cb7f9",
      "name": "Puxar N8N",
      "credentials": {
        "n8nApi": {
          "id": "VVl8WR9plNxe3m7j",
          "name": "N8N - API"
        }
      }
    },
    {
      "parameters": {
        "operation": "toJson",
        "mode": "each",
        "options": {
          "fileName": "={{ $json.name }}.json"
        }
      },
      "type": "n8n-nodes-base.convertToFile",
      "typeVersion": 1.1,
      "position": [
        420,
        220
      ],
      "id": "459c5a26-1a6c-414f-ba9c-d792ca0efcac",
      "name": "Converter para JSON"
    },
    {
      "parameters": {
        "name": "={{ $binary.data.fileName }}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "folderId": {
          "__rl": true,
          "value": "={{ $('Criar pasta').item.json.id }}",
          "mode": "id"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [
        660,
        220
      ],
      "id": "777e5b12-7ce0-4c3e-9606-383ea0c4d1ab",
      "name": "Upload",
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "Igcs9JkgzmibbwCV",
          "name": "Drive - Cyborgs Edu"
        }
      }
    },
    {
      "parameters": {
        "resource": "fileFolder",
        "queryString": "=Backup N8N - {{ $now.format('dd-MM-yyyy') }}",
        "filter": {
          "driveId": {
            "mode": "list",
            "value": "My Drive"
          },
          "folderId": {
            "__rl": true,
            "value": "19SQ5L5yW5Qnwp8BGh2r46uKdx2_JRiNP",
            "mode": "list",
            "cachedResultName": "N8N - BACKUP ",
            "cachedResultUrl": "https://drive.google.com/drive/folders/19SQ5L5yW5Qnwp8BGh2r46uKdx2_JRiNP"
          }
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [
        -760,
        200
      ],
      "id": "1b47ab86-012a-410b-a8f2-4a9953fc284e",
      "name": "Verificar Pasta",
      "alwaysOutputData": true,
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "MHIHC3Qsp3lRROEN",
          "name": "Google Drive - Transcrever Audio"
        }
      }
    }
  ],
  "pinData": {},
  "connections": {
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Verificar Pasta",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Criar pasta": {
      "main": [
        [
          {
            "node": "Puxar N8N",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Deletar pasta": {
      "main": [
        [
          {
            "node": "Criar pasta",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Pasta Existe": {
      "main": [
        [
          {
            "node": "Deletar pasta",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Criar pasta",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Puxar N8N": {
      "main": [
        [
          {
            "node": "Converter para JSON",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Converter para JSON": {
      "main": [
        [
          {
            "node": "Upload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Verificar Pasta": {
      "main": [
        [
          {
            "node": "Pasta Existe",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "36c1b034-c109-42ad-8867-8be5c236dd81",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "441a868ae25298208d2769d08e359d03ddd0984fd8f199212738af3062bc7d36"
  },
  "id": "KGS7NvJvX94d8oHU",
  "tags": []
}