{
  "name": "Nightly n8n backup to Google Drive",
  "nodes": [
    {
      "id": "f15465bd-4e59-41cc-af98-bef0be10ae91",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1520,
        0
      ],
      "parameters": {
        "width": 919,
        "height": 298,
        "content": "MOVE CURRENT BACKUPS TO OLD FOLDER\n\n* GET CURRENT BACKUPS: Retrieves a list of current backups in the n8n_backups folder.\n* Loop Over Items: Iterates over files and moves them to the n8n_old folder.\n*"
      }
    },
    {
      "id": "64aa8582-e23a-4a1c-81b0-c79dd330b81f",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1024,
        576
      ],
      "parameters": {
        "width": 1417.9765108650786,
        "height": 203.50281832188898,
        "content": "PURGE BACKUPS OLDER THEN 30 DAYS\nIdentifies backups that are more than 30 days old and deletes them (code)."
      }
    },
    {
      "id": "3a04bbfd-7acb-44d8-b192-e0189873ae09",
      "name": "Move Binary Data",
      "type": "n8n-nodes-base.moveBinaryData",
      "position": [
        1792,
        416
      ]
    },
    {
      "id": "da789082-c7f0-4fc2-bf92-aa4eb61bf274",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        0
      ],
      "parameters": {
        "width": 1003.460056384994,
        "height": 781.8511818911037,
        "content": "## GET GOOGLE DRIVE FOLDERS\n"
      }
    },
    {
      "id": "589b84c5-af3c-4619-a9db-0ecc18bd9924",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1024,
        0
      ],
      "parameters": {
        "width": 475,
        "height": 179,
        "content": "## Ignore any other folders other than: n8n_backups\n\n\n\n(it is important that you created this folder)"
      }
    },
    {
      "id": "5ff923b3-fbe5-4e5a-a4df-2b3275a6db0b",
      "name": "IGNORE FILES",
      "type": "n8n-nodes-base.filter",
      "position": [
        1376,
        48
      ]
    },
    {
      "id": "6a688597-a447-481f-a108-963bdd941f31",
      "name": "Create n8n_backups",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        752,
        416
      ]
    },
    {
      "id": "ba0246cd-b9fa-4765-8105-64cd6591f64f",
      "name": "Create n8n_old",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        752,
        576
      ]
    },
    {
      "id": "9f01a57e-9cf1-401f-af6b-c98de95ad4ff",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        640,
        304
      ],
      "parameters": {
        "width": 327.6965514381564,
        "height": 451.756147757587,
        "content": "### Since the n8n backups and n8n old folders are missing, they are created automatically."
      }
    },
    {
      "id": "c97d8957-2d61-4db8-9c7f-ad246ddf98a5",
      "name": "GET CURRENT FOLDER",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        64,
        272
      ]
    },
    {
      "id": "0d09ed07-6d1e-4ead-afc6-9f6e3788b90f",
      "name": "Code",
      "type": "n8n-nodes-base.code",
      "position": [
        240,
        272
      ]
    },
    {
      "id": "c6bc139e-4f89-4b80-9d2d-3fc38befd9aa",
      "name": "If n8n_old",
      "type": "n8n-nodes-base.if",
      "position": [
        432,
        336
      ]
    },
    {
      "id": "41f874f2-f068-4bf9-8f64-102cff9e7d0a",
      "name": "If1 n8n_backups",
      "type": "n8n-nodes-base.if",
      "position": [
        432,
        192
      ]
    },
    {
      "id": "e70ef45f-0846-46b8-bc07-00bb3d5513e9",
      "name": "GET CURRENT FOLDER CREATES",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        848,
        48
      ]
    },
    {
      "id": "e5551b95-053a-4602-8a69-ab65311b0ac2",
      "name": "Merge mensage",
      "type": "n8n-nodes-base.merge",
      "position": [
        672,
        112
      ]
    },
    {
      "id": "f90814d5-b255-40ab-b687-3d896e17e27e",
      "name": "GET CURRENT BACKUPS1",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1600,
        112
      ]
    },
    {
      "id": "c99cfde8-8f91-4621-a5b0-37e3da5d1014",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        240,
        144
      ],
      "parameters": {
        "width": 344.6035366824252,
        "height": 320.16281145907226,
        "content": "### The system automatically creates the folders n8n_backups and n8n_old if they do not already exist."
      }
    },
    {
      "id": "0a8bbaec-bb59-4f09-b7fd-c025c62e8791",
      "name": "MOVE INTO OLD FOLDER",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        2272,
        112
      ]
    },
    {
      "id": "30c3dbf6-c941-4115-aba9-431400836d39",
      "name": "UPLOAD WORKFLOWS",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        2272,
        384
      ]
    },
    {
      "id": "42fd608f-3bc2-41a7-9ae4-8eac32939686",
      "name": "Item Lists",
      "type": "n8n-nodes-base.itemLists",
      "position": [
        1792,
        112
      ]
    },
    {
      "id": "29e6a7b3-cf77-4bea-afdb-3fe22f3f7b0f",
      "name": "LIST OLD BACKUPS",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1488,
        640
      ]
    },
    {
      "id": "af5bfced-4322-40da-a8ba-7c5fa08d8e5c",
      "name": "DELETE OLD BACKUP",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        2288,
        592
      ]
    },
    {
      "id": "e7f76f8b-1b97-4b53-806b-8d823febb862",
      "name": "Item Lists old",
      "type": "n8n-nodes-base.itemLists",
      "position": [
        1872,
        640
      ]
    },
    {
      "id": "88d5e7d2-5ed6-4024-9713-3d9204005aff",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1024,
        208
      ],
      "parameters": {
        "width": 477,
        "height": 359,
        "content": "### Bug Fixes & Improvements v5\n* **Purge Folder Verification:** Fixed the way files are retrieved from the purge folder. Now, it first checks if the folder exists before attempting to delete it.\n> *P"
      }
    },
    {
      "id": "48d4773d-eaf3-47f9-9f07-eba0ef843f68",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1520,
        320
      ],
      "parameters": {
        "width": 921,
        "height": 240,
        "content": "BACKUP ALL CURRENT WORKFLOWS limit 100 (Change)\n\n* Move Binary Data: Converts data to JSON format for processing.\n* UPLOAD WORKFLOWS: Uploads up to 100 workflows to storage as a backup."
      }
    },
    {
      "id": "8834bd53-b442-414e-ba82-f99666c543c7",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        2032,
        112
      ]
    },
    {
      "id": "6eeb993b-9edf-4875-99aa-03700706379e",
      "name": "Loop Over Items current",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        2048,
        352
      ]
    },
    {
      "id": "cc6b1faf-258c-4a55-bc6b-fccb272f7baa",
      "name": "Loop Over Items purge",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        2048,
        592
      ]
    },
    {
      "id": "db105a20-fc7b-4595-bfd5-f02cd3be2bb5",
      "name": "GET CURRENT FOLDER CREATES1",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1264,
        640
      ]
    },
    {
      "id": "83f4ee0b-b480-49e7-809f-4fc320b2f749",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        64,
        80
      ]
    },
    {
      "id": "bba95c0e-2927-46b5-bd4d-649f42fbf302",
      "name": "you can delete",
      "type": "n8n-nodes-base.code",
      "position": [
        1680,
        640
      ]
    },
    {
      "id": "cf765220-193d-4c0a-ba28-cc49b0190717",
      "name": "PURGE DAYS",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        1072,
        640
      ]
    },
    {
      "id": "0acd9c0e-047b-4194-ad36-00249d044006",
      "name": "Sticky Note12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        640,
        32
      ],
      "parameters": {
        "width": 150,
        "height": 210.7148610748136,
        "content": "Combines detected folder lists for processing."
      }
    },
    {
      "id": "69c11b7f-58e5-45ce-9617-55718ac187e0",
      "name": "Get many workflows",
      "type": "n8n-nodes-base.n8n",
      "position": [
        1600,
        416
      ]
    },
    {
      "id": "3b1ffc79-709a-4be8-bd7c-cad163fbb353",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -480,
        0
      ],
      "parameters": {
        "width": 461,
        "height": 775,
        "content": "### Description\nThis template creates a nightly backup of all n8n workflows and saves them to a **Google Drive** folder. Each night, the previous night's backups are moved to an “n8n_old” folder and r"
      }
    },
    {
      "id": "f48622b1-4a18-4274-84e2-b3206886dc51",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        32,
        432
      ],
      "parameters": {
        "width": 529,
        "height": 309,
        "content": "## Contact me\n**By Mail**: [Send Mail](mailto:nuntius.creative.hub@gmail.com)\n**By LinkedIn**: [LinkedIn](https://www.linkedin.com/in/jeyson-orozco/)\n\n### Workflow Logic\n* **Schedule Trigger**: Automa"
      }
    }
  ],
  "connections": {
    "Code": {
      "main": [
        [
          {
            "node": "If n8n_old",
            "type": "main",
            "index": 0
          },
          {
            "node": "If1 n8n_backups",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If n8n_old": {
      "main": [
        [
          {
            "node": "Create n8n_old",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Merge mensage",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Item Lists": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "PURGE DAYS": {
      "main": [
        [
          {
            "node": "GET CURRENT FOLDER CREATES1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IGNORE FILES": {
      "main": [
        [
          {
            "node": "GET CURRENT BACKUPS1",
            "type": "main",
            "index": 0
          },
          {
            "node": "Get many workflows",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge mensage": {
      "main": [
        [
          {
            "node": "GET CURRENT FOLDER CREATES",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create n8n_old": {
      "main": [
        [
          {
            "node": "GET CURRENT FOLDER",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Item Lists old": {
      "main": [
        [
          {
            "node": "Loop Over Items purge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "you can delete": {
      "main": [
        [
          {
            "node": "Item Lists old",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If1 n8n_backups": {
      "main": [
        [
          {
            "node": "Create n8n_backups",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Merge mensage",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "MOVE INTO OLD FOLDER",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "LIST OLD BACKUPS": {
      "main": [
        [
          {
            "node": "you can delete",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Move Binary Data": {
      "main": [
        [
          {
            "node": "Loop Over Items current",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "GET CURRENT FOLDER",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "UPLOAD WORKFLOWS": {
      "main": [
        [
          {
            "node": "Loop Over Items current",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "DELETE OLD BACKUP": {
      "main": [
        [
          {
            "node": "Loop Over Items purge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create n8n_backups": {
      "main": [
        [
          {
            "node": "GET CURRENT FOLDER",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GET CURRENT FOLDER": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get many workflows": {
      "main": [
        [
          {
            "node": "Move Binary Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GET CURRENT BACKUPS1": {
      "main": [
        [
          {
            "node": "Item Lists",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "MOVE INTO OLD FOLDER": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items purge": {
      "main": [
        [],
        [
          {
            "node": "DELETE OLD BACKUP",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items current": {
      "main": [
        [],
        [
          {
            "node": "UPLOAD WORKFLOWS",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GET CURRENT FOLDER CREATES": {
      "main": [
        [
          {
            "node": "IGNORE FILES",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GET CURRENT FOLDER CREATES1": {
      "main": [
        [
          {
            "node": "LIST OLD BACKUPS",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}