8
n8n 中文网amn8n.com

自动化每日工作流备份至 Google Drive 并清理

高级

这是一个自动化工作流,包含 32 个节点。主要使用 N8n, Filter, GoogleDrive, ConvertToFile, SplitInBatches 等节点。 自动化每日工作流备份至 Google Drive 并清理

前置要求
  • Google Drive API 凭证

分类

-
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "7de9c03c5df732f2294cfa53379db42b70689739afb5ed84c40dd844fed72f02",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "9a8eb9c2-a0c9-4f80-9c6c-5774802edc14",
      "name": "便签 3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        -1168
      ],
      "parameters": {
        "width": 352,
        "height": 636,
        "content": "## 🔄 批量处理"
      },
      "typeVersion": 1
    },
    {
      "id": "080b0687-a519-41c7-8cee-55ca311c5522",
      "name": "便签 4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        288,
        -720
      ],
      "parameters": {
        "width": 300,
        "height": 432,
        "content": "## 📄 转换和保存"
      },
      "typeVersion": 1
    },
    {
      "id": "e804abef-76e2-400c-a216-c6ed051a548e",
      "name": "便签 5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        336,
        -1216
      ],
      "parameters": {
        "width": 340,
        "height": 464,
        "content": "## 🧹 清理旧备份"
      },
      "typeVersion": 1
    },
    {
      "id": "88016564-b3a2-4619-8804-94fd5a8cef19",
      "name": "n8n1",
      "type": "n8n-nodes-base.n8n",
      "position": [
        -464,
        -720
      ],
      "parameters": {
        "filters": {},
        "requestOptions": {}
      },
      "credentials": {
        "n8nApi": {
          "id": "LpZFBbXA3FYzNTY8",
          "name": "n8n account"
        }
      },
      "retryOnFail": true,
      "typeVersion": 1,
      "alwaysOutputData": true
    },
    {
      "id": "db19b42f-6573-4d18-821d-d9ae63a4fe1d",
      "name": "遍历项目1循环",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -48,
        -720
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "5d4fc25e-d535-4b4b-8c5d-890ce53e2684",
      "name": "创建新文件夹1",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -752,
        -720
      ],
      "parameters": {
        "name": "=Workflow Backups {{ $now.format('cccc t dd-MM-yyyy') }}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive",
          "cachedResultUrl": "https://drive.google.com/drive/my-drive",
          "cachedResultName": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "1dCNZ_oYzukeFsaKWhukX1l_Hsi57ns9m",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1dCNZ_oYzukeFsaKWhukX1l_Hsi57ns9m",
          "cachedResultName": "N8N"
        },
        "resource": "folder"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "bC9XIOLdXmo67x1E",
          "name": "Google Drive account"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "93ba9bf9-7232-4247-bb69-9bc643ce43e3",
      "name": "转换为文件1",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        144,
        -704
      ],
      "parameters": {
        "options": {
          "format": true,
          "fileName": "={{ $json.name + \".json\" }} "
        },
        "operation": "toJson"
      },
      "typeVersion": 1.1
    },
    {
      "id": "44b739ab-cb61-4729-b49f-aaed42ddec4a",
      "name": "Google Drive1",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        384,
        -448
      ],
      "parameters": {
        "name": "={{ $('Loop Over Items1').item.json.name + \".json\" }}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive",
          "cachedResultUrl": "https://drive.google.com/drive/my-drive",
          "cachedResultName": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('create new folder1').item.json.id }}"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "bC9XIOLdXmo67x1E",
          "name": "Google Drive account"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "9b6bb07c-30e1-4649-acb6-f886ad65c288",
      "name": "计划触发器1",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -1040,
        -656
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 4
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "6d801bc0-93f6-4181-88bf-2f8e0135d0e6",
      "name": "过滤器1",
      "type": "n8n-nodes-base.filter",
      "position": [
        368,
        -896
      ],
      "parameters": {
        "options": {
          "ignoreCase": true
        },
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": false,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "538fc29d-2693-4c62-9848-bdcaf8566909",
              "operator": {
                "type": "string",
                "operation": "notEquals"
              },
              "leftValue": "={{ $json.id }}",
              "rightValue": "={{ $('create new folder1').item.json.id }}"
            }
          ]
        },
        "looseTypeValidation": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "699773cd-698c-4615-9903-848f5f9f3fa7",
      "name": "删除文件夹1",
      "type": "n8n-nodes-base.googleDrive",
      "onError": "continueRegularOutput",
      "position": [
        560,
        -896
      ],
      "parameters": {
        "options": {
          "deletePermanently": true
        },
        "resource": "folder",
        "operation": "deleteFolder",
        "folderNoRootId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.id }}"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "LyM4iZs87sZ5FP8C",
          "name": "HTA"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "eb1ead32-9668-4fb6-862b-1ab72247daae",
      "name": "获取文件夹1",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        144,
        -896
      ],
      "parameters": {
        "filter": {
          "folderId": {
            "__rl": true,
            "mode": "list",
            "value": "1dCNZ_oYzukeFsaKWhukX1l_Hsi57ns9m",
            "cachedResultUrl": "https://drive.google.com/drive/folders/1dCNZ_oYzukeFsaKWhukX1l_Hsi57ns9m",
            "cachedResultName": "N8N"
          },
          "whatToSearch": "folders"
        },
        "options": {
          "fields": [
            "id"
          ]
        },
        "resource": "fileFolder"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "bC9XIOLdXmo67x1E",
          "name": "Google Drive account"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "a4f48d76-3f4a-4f18-9c91-d1acdb528996",
      "name": "便签7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1184,
        -864
      ],
      "parameters": {
        "width": 280,
        "height": 344,
        "content": "## ⏰ 自动触发器"
      },
      "typeVersion": 1
    },
    {
      "id": "dfd9be89-436e-4479-99d6-7deedb5db9c0",
      "name": "便签8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -848,
        -1024
      ],
      "parameters": {
        "width": 300,
        "height": 480,
        "content": "## 📁 创建备份文件夹"
      },
      "typeVersion": 1
    },
    {
      "id": "59023d6c-d08e-4d3d-999c-3ba67e2e15f4",
      "name": "便签9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -528,
        -1104
      ],
      "parameters": {
        "height": 532,
        "content": "## 🔌 连接 n8n API"
      },
      "typeVersion": 1
    },
    {
      "id": "56e3c0ce-d77d-4b2d-bbba-93637fa98aed",
      "name": "n8n2",
      "type": "n8n-nodes-base.n8n",
      "position": [
        2160,
        -816
      ],
      "parameters": {
        "filters": {},
        "requestOptions": {}
      },
      "credentials": {
        "n8nApi": {
          "id": "LpZFBbXA3FYzNTY8",
          "name": "n8n account"
        }
      },
      "retryOnFail": true,
      "typeVersion": 1,
      "alwaysOutputData": true
    },
    {
      "id": "997369a0-e77b-4cc8-bf12-8ab7eb1b3e8f",
      "name": "遍历项目2",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        2496,
        -816
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "85d5f584-a0c6-48b1-93f4-6c5ba5dc7d40",
      "name": "创建新文件夹2",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1888,
        -816
      ],
      "parameters": {
        "name": "=Workflow Backups {{ $now.format('cccc t dd-MM-yyyy') }}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive",
          "cachedResultUrl": "https://drive.google.com/drive/my-drive",
          "cachedResultName": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "1dCNZ_oYzukeFsaKWhukX1l_Hsi57ns9m",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1dCNZ_oYzukeFsaKWhukX1l_Hsi57ns9m",
          "cachedResultName": "N8N"
        },
        "resource": "folder"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "bC9XIOLdXmo67x1E",
          "name": "Google Drive account"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "887aee74-330f-4170-93f2-0ddda5d52704",
      "name": "转换为文件2",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        2720,
        -816
      ],
      "parameters": {
        "options": {
          "format": true,
          "fileName": "={{ $json.name + \".json\" }} "
        },
        "operation": "toJson"
      },
      "typeVersion": 1.1
    },
    {
      "id": "2d57c096-2d05-477c-bea8-aeb3aedbdfcb",
      "name": "Google Drive2",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        2944,
        -528
      ],
      "parameters": {
        "name": "={{ $('Loop Over Items2').item.json.name + \".json\" }}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive",
          "cachedResultUrl": "https://drive.google.com/drive/my-drive",
          "cachedResultName": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('create new folder2').item.json.id }}"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "bC9XIOLdXmo67x1E",
          "name": "Google Drive account"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "a3f33a72-7376-4a1e-8585-e0bc052c401b",
      "name": "计划触发器2",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        1616,
        -736
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 4
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "d995f52f-d70f-49ad-b467-2da9b343e275",
      "name": "过滤器2",
      "type": "n8n-nodes-base.filter",
      "position": [
        2944,
        -1008
      ],
      "parameters": {
        "options": {
          "ignoreCase": true
        },
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": false,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "538fc29d-2693-4c62-9848-bdcaf8566909",
              "operator": {
                "type": "string",
                "operation": "notEquals"
              },
              "leftValue": "={{ $json.id }}",
              "rightValue": "={{ $('create new folder2').item.json.id }}"
            }
          ]
        },
        "looseTypeValidation": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "b7a7f2b6-68d1-48b1-aed9-c008c655d087",
      "name": "删除文件夹2",
      "type": "n8n-nodes-base.googleDrive",
      "onError": "continueRegularOutput",
      "position": [
        3152,
        -1008
      ],
      "parameters": {
        "options": {
          "deletePermanently": true
        },
        "resource": "folder",
        "operation": "deleteFolder",
        "folderNoRootId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.id }}"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "LyM4iZs87sZ5FP8C",
          "name": "HTA"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "9d40c609-886f-404c-8b43-f1909174d09f",
      "name": "获取文件夹2",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        2720,
        -1008
      ],
      "parameters": {
        "filter": {
          "folderId": {
            "__rl": true,
            "mode": "list",
            "value": "1dCNZ_oYzukeFsaKWhukX1l_Hsi57ns9m",
            "cachedResultUrl": "https://drive.google.com/drive/folders/1dCNZ_oYzukeFsaKWhukX1l_Hsi57ns9m",
            "cachedResultName": "N8N"
          },
          "whatToSearch": "folders"
        },
        "options": {
          "fields": [
            "id"
          ]
        },
        "resource": "fileFolder"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "bC9XIOLdXmo67x1E",
          "name": "Google Drive account"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "2cfae624-9916-4aa7-ac7a-fc4e726139c2",
      "name": "便签 10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1472,
        -912
      ],
      "parameters": {
        "width": 280,
        "height": 312,
        "content": "## ⏰ 自动触发器"
      },
      "typeVersion": 1
    },
    {
      "id": "538c9518-1ce8-4997-9bc8-e4e570c596e3",
      "name": "便签11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1776,
        -1152
      ],
      "parameters": {
        "width": 300,
        "height": 544,
        "content": "## 📁 备份文件夹创建"
      },
      "typeVersion": 1
    },
    {
      "id": "2a5683a7-2340-497b-85a8-fc10c84f77d7",
      "name": "便签 12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2096,
        -1216
      ],
      "parameters": {
        "width": 224,
        "height": 596,
        "content": "## 🔌 n8n API 连接"
      },
      "typeVersion": 1
    },
    {
      "id": "d0e33a4e-294b-4c7f-a476-61b93a16de5f",
      "name": "便签 13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2464,
        -1280
      ],
      "parameters": {
        "width": 400,
        "height": 652,
        "content": "## 🔄 批量处理"
      },
      "typeVersion": 1
    },
    {
      "id": "d2419fcd-cb46-4cfe-920e-56b82a1cc02d",
      "name": "便签14",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2896,
        -816
      ],
      "parameters": {
        "width": 300,
        "height": 416,
        "content": "## 📄 转换和保存"
      },
      "typeVersion": 1
    },
    {
      "id": "a6b308ed-af2b-437a-8e22-07ffc5d535d9",
      "name": "便签15",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2928,
        -1296
      ],
      "parameters": {
        "width": 340,
        "height": 464,
        "content": "## 🧹 旧备份清理"
      },
      "typeVersion": 1
    },
    {
      "id": "5c59ff97-5705-4746-91dc-8da0b0ccf997",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1184,
        -1536
      ],
      "parameters": {
        "color": 3,
        "width": 1936,
        "height": 1312,
        "content": "# 西班牙语"
      },
      "typeVersion": 1
    },
    {
      "id": "f477459f-73de-4390-8c36-4f5251fdaec0",
      "name": "便签 1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1392,
        -1536
      ],
      "parameters": {
        "color": 3,
        "width": 2080,
        "height": 1312,
        "content": "# 英语"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "n8n1": {
      "main": [
        [
          {
            "node": "Loop Over Items1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "n8n2": {
      "main": [
        [
          {
            "node": "Loop Over Items2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter1": {
      "main": [
        [
          {
            "node": "delete folder1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter2": {
      "main": [
        [
          {
            "node": "delete folder2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get folders1": {
      "main": [
        [
          {
            "node": "Filter1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get folders2": {
      "main": [
        [
          {
            "node": "Filter2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Drive1": {
      "main": [
        [
          {
            "node": "Loop Over Items1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Drive2": {
      "main": [
        [
          {
            "node": "Loop Over Items2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert to File1": {
      "main": [
        [
          {
            "node": "Google Drive1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert to File2": {
      "main": [
        [
          {
            "node": "Google Drive2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items1": {
      "main": [
        [
          {
            "node": "Get folders1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Convert to File1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items2": {
      "main": [
        [
          {
            "node": "Get folders2",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Convert to File2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger1": {
      "main": [
        [
          {
            "node": "create new folder1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger2": {
      "main": [
        [
          {
            "node": "create new folder2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "create new folder1": {
      "main": [
        [
          {
            "node": "n8n1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "create new folder2": {
      "main": [
        [
          {
            "node": "n8n2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

高级

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
高级
节点数量32
分类-
节点类型7
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

作者
Jose Bossa

Jose Bossa

@bossa

AI consultant with over 3 months and high ticket salesman over 2 years.

外部链接
在 n8n.io 查看

分享此工作流