8
n8n 中文网amn8n.com

每 4 小时备份所有 n8n 工作流到 Google Drive

中级

这是一个Other领域的自动化工作流,包含 10 个节点。主要使用 N8n, Filter, GoogleDrive, ConvertToFile, ManualTrigger 等节点。 每 4 小时备份所有 n8n 工作流到 Google Drive

前置要求
  • Google Drive API 凭证

分类

工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "db80165df40cb07c0377167c050b3f9ab0b0fb04f0e8cae0dc53f5a8527103ca",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "62edf095-a02a-4b8d-a7b1-e194ae0d3652",
      "name": "点击“执行”时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -660,
        1100
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "1e10875b-f54b-43a8-a7a2-43d4fcbf248d",
      "name": "n8n",
      "type": "n8n-nodes-base.n8n",
      "position": [
        -300,
        1220
      ],
      "parameters": {
        "filters": {},
        "requestOptions": {}
      },
      "credentials": {
        "n8nApi": {
          "id": "uqWyCDytVt4ZKbVE",
          "name": "Phoenix✅"
        }
      },
      "retryOnFail": true,
      "typeVersion": 1,
      "alwaysOutputData": true
    },
    {
      "id": "1f5caabb-d76b-4744-be76-97e9abea1ddc",
      "name": "遍历项目",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -100,
        1220
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "755e0803-c5c0-48a7-9c0c-44f8d5718d0b",
      "name": "创建新文件夹",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -480,
        1220
      ],
      "parameters": {
        "name": "=Workflow Backups {{ $now.format('cccc t dd-MM-yyyy') }}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "1hnHubRgcstU8OgV8BPwPNivfTZT5g2Wf",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1hnHubRgcstU8OgV8BPwPNivfTZT5g2Wf",
          "cachedResultName": "Workflow Backups"
        },
        "resource": "folder"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "HqlejV5xP0lqTq5e",
          "name": "Google Drive account✅"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "22874532-6d87-4a72-bb51-dd8c6e03c0c1",
      "name": "转换为文件",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        120,
        1320
      ],
      "parameters": {
        "options": {
          "format": true,
          "fileName": "={{ $json.name + \".json\" }} "
        },
        "operation": "toJson"
      },
      "typeVersion": 1.1
    },
    {
      "id": "0b0155f1-15bc-4580-af6e-7dec3b0d5737",
      "name": "Google Drive",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        300,
        1320
      ],
      "parameters": {
        "name": "={{ $('Loop Over Items').item.json.name + \".json\" }}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('create new folder').item.json.id }}"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "HqlejV5xP0lqTq5e",
          "name": "Google Drive account✅"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "c7b73036-1831-4dd6-8dd9-fef1356a184c",
      "name": "计划触发器",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -660,
        1360
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours",
              "hoursInterval": 4
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "666dcf95-928c-4270-808f-755a9771a410",
      "name": "过滤器",
      "type": "n8n-nodes-base.filter",
      "position": [
        300,
        1120
      ],
      "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 folder').item.json.id }}"
            }
          ]
        },
        "looseTypeValidation": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "f6f44cbe-a98e-4a49-8c4c-59ebe02db9e5",
      "name": "删除文件夹",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        480,
        1120
      ],
      "parameters": {
        "options": {
          "deletePermanently": true
        },
        "resource": "folder",
        "operation": "deleteFolder",
        "folderNoRootId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.id }}"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "HqlejV5xP0lqTq5e",
          "name": "Google Drive account✅"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "d96a009f-08d3-4f0d-9f70-f9e0de9b9f91",
      "name": "获取文件夹",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        120,
        1120
      ],
      "parameters": {
        "filter": {
          "folderId": {
            "__rl": true,
            "mode": "list",
            "value": "1hnHubRgcstU8OgV8BPwPNivfTZT5g2Wf",
            "cachedResultUrl": "https://drive.google.com/drive/folders/1hnHubRgcstU8OgV8BPwPNivfTZT5g2Wf",
            "cachedResultName": "Workflow Backups"
          }
        },
        "options": {},
        "resource": "fileFolder"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "HqlejV5xP0lqTq5e",
          "name": "Google Drive account✅"
        }
      },
      "typeVersion": 3
    }
  ],
  "pinData": {},
  "connections": {
    "n8n": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter": {
      "main": [
        [
          {
            "node": "delete folder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get folders": {
      "main": [
        [
          {
            "node": "Filter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Drive": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "delete folder": {
      "main": [
        []
      ]
    },
    "Convert to File": {
      "main": [
        [
          {
            "node": "Google Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "Get folders",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Convert to File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "create new folder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "create new folder": {
      "main": [
        [
          {
            "node": "n8n",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On clicking 'execute'": {
      "main": [
        [
          {
            "node": "create new folder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 其他

需要付费吗?

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

工作流信息
难度等级
中级
节点数量10
分类1
节点类型7
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

作者
Imperol

Imperol

@imperolq

Automation expert with years of experience helping businesses improve their efficiency and productivity with smart automations that are affordable, scalable, and flexible.

外部链接
在 n8n.io 查看

分享此工作流