✨😃 自动工作流备份到Google Drive
高级
这是一个Other领域的自动化工作流,包含 22 个节点。主要使用 N8n, Set, Code, Limit, Telegram 等节点。 ✨😃 自动工作流备份到Google Drive
前置要求
- •Telegram Bot Token
- •Google Drive API 凭证
使用的节点 (22)
分类
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "o4sdVtTrkuZXDATf",
"meta": {
"instanceId": "31e69f7f4a77bf465b805824e303232f0227212ae922d12133a0f96ffeab4fef",
"templateCredsSetupCompleted": true
},
"name": "✨😃自动工作流备份到 Google Drive",
"tags": [],
"nodes": [
{
"id": "f3eba5f7-534e-4eaa-ac84-850d51ff2936",
"name": "点击“执行”时",
"type": "n8n-nodes-base.manualTrigger",
"position": [
620,
-140
],
"parameters": {},
"typeVersion": 1
},
{
"id": "383e4bed-38ec-4b2f-890c-9b0d9cda8e11",
"name": "遍历项目",
"type": "n8n-nodes-base.splitInBatches",
"position": [
1140,
340
],
"parameters": {
"options": {
"reset": false
}
},
"typeVersion": 3
},
{
"id": "38c4c909-fa18-4fa3-abf5-6b9bd2d46718",
"name": "每天",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
620,
80
],
"parameters": {
"rule": {
"interval": [
{}
]
}
},
"typeVersion": 1.2
},
{
"id": "67f62b6e-fe37-4638-89ce-9fe1de041282",
"name": "创建带时间戳的文件夹",
"type": "n8n-nodes-base.googleDrive",
"position": [
1220,
-40
],
"parameters": {
"name": "=n8n-Workflow-Backups-{{ $json.datetime }}",
"driveId": {
"__rl": true,
"mode": "list",
"value": "My Drive"
},
"options": {},
"folderId": {
"__rl": true,
"mode": "list",
"value": "root",
"cachedResultName": "/ (Root folder)"
},
"resource": "folder"
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "UhdXGYLTAJbsa0xX",
"name": "Google Drive account"
}
},
"typeVersion": 3
},
{
"id": "cfbda56a-2d14-4d64-b40d-89961c0cf0f4",
"name": "获取日期时间",
"type": "n8n-nodes-base.set",
"position": [
920,
-40
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "2589e80c-e8c3-4872-bd7a-d3e92f4a6ab7",
"name": "datetime",
"type": "string",
"value": "={{ $now }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "93e8097f-9e7d-49ff-9133-4fd8590f7e31",
"name": "获取工作流",
"type": "n8n-nodes-base.n8n",
"position": [
1520,
-40
],
"parameters": {
"filters": {},
"requestOptions": {}
},
"credentials": {
"n8nApi": {
"id": "49QOgnBpyVcT7XQF",
"name": "n8n account"
}
},
"typeVersion": 1
},
{
"id": "d848ce1d-beb7-4e25-82ac-ed0e8f9523e0",
"name": "限制为200个",
"type": "n8n-nodes-base.limit",
"position": [
1820,
-40
],
"parameters": {
"maxItems": 200
},
"typeVersion": 1
},
{
"id": "18f61908-97ce-478c-8544-cfedef22a94c",
"name": "将工作流转换为 JSON 文件",
"type": "n8n-nodes-base.convertToFile",
"position": [
1400,
340
],
"parameters": {
"options": {
"fileName": "={{ $json.name }}"
},
"operation": "toJson"
},
"typeVersion": 1.1
},
{
"id": "97690d84-a0cd-4169-83a8-e4f1d189837e",
"name": "将 JSON 文件保存到 Google Drive 文件夹",
"type": "n8n-nodes-base.googleDrive",
"position": [
1600,
340
],
"parameters": {
"name": "={{ $binary.data.fileName }}.json",
"driveId": {
"__rl": true,
"mode": "list",
"value": "My Drive"
},
"options": {},
"folderId": {
"__rl": true,
"mode": "id",
"value": "={{ $('Create Folder with DateTime Stamp').item.json.id }}"
}
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "UhdXGYLTAJbsa0xX",
"name": "Google Drive account"
}
},
"typeVersion": 3
},
{
"id": "452c0ce8-6e1f-41d7-a94c-25c7abbc32ad",
"name": "执行一次",
"type": "n8n-nodes-base.noOp",
"position": [
980,
720
],
"parameters": {},
"executeOnce": true,
"typeVersion": 1
},
{
"id": "aadc54d7-2458-4b5b-aa65-07aff52626d2",
"name": "搜索文件夹名称",
"type": "n8n-nodes-base.googleDrive",
"position": [
1180,
720
],
"parameters": {
"limit": 10,
"filter": {
"whatToSearch": "folders"
},
"options": {},
"resource": "fileFolder",
"queryString": "n8n-Workflow-Backups"
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "UhdXGYLTAJbsa0xX",
"name": "Google Drive account"
}
},
"executeOnce": true,
"typeVersion": 3
},
{
"id": "fcb210bf-4947-4178-b85a-8425eb72d937",
"name": "删除文件夹",
"type": "n8n-nodes-base.googleDrive",
"onError": "continueRegularOutput",
"position": [
1600,
720
],
"parameters": {
"options": {
"deletePermanently": true
},
"resource": "folder",
"operation": "deleteFolder",
"folderNoRootId": {
"__rl": true,
"mode": "id",
"value": "={{ $json.id }}"
}
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "UhdXGYLTAJbsa0xX",
"name": "Google Drive account"
}
},
"typeVersion": 3,
"alwaysOutputData": true
},
{
"id": "ccdc0655-75e9-4c6b-8ebb-76477733289b",
"name": "完成消息",
"type": "n8n-nodes-base.telegram",
"position": [
960,
1040
],
"webhookId": "382a3b43-b83f-47b1-a276-67c6b98a441a",
"parameters": {
"text": "={{ $now }}\nWorkflows Backup Complete\n{{ $('Create Folder with DateTime Stamp').item.json.name }}\nhttps://drive.google.com/drive/folders/{{ $('Create Folder with DateTime Stamp').item.json.id }}",
"chatId": "={{ $env.TELEGRAM_CHAT_ID }}",
"additionalFields": {
"parse_mode": "HTML",
"appendAttribution": false
}
},
"credentials": {
"telegramApi": {
"id": "pAIFhguJlkO3c7aQ",
"name": "Telegram account"
}
},
"typeVersion": 1.2
},
{
"id": "972b4921-803f-4510-9894-9acd2713816a",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
1020,
220
],
"parameters": {
"color": 5,
"width": 800,
"height": 360,
"content": "## 将工作流保存到 Google Drive"
},
"typeVersion": 1
},
{
"id": "254d12e9-0ca6-4953-b375-66a883b44d41",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
840,
620
],
"parameters": {
"color": 3,
"width": 980,
"height": 300,
"content": "## 保留最近7个文件夹(天数)并删除其他"
},
"typeVersion": 1
},
{
"id": "a1f25512-16d1-45e9-8b18-706288543e03",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
840,
960
],
"parameters": {
"width": 340,
"height": 260,
"content": "## 通过 Telegram 通知用户"
},
"typeVersion": 1
},
{
"id": "36182be7-f575-4f28-8d63-39802b8428ba",
"name": "查找要删除的文件夹",
"type": "n8n-nodes-base.code",
"position": [
1400,
720
],
"parameters": {
"jsCode": "// Get all input items and sort by name in descending order\nconst sortedItems = $input.all().sort((a, b) => {\n if (!a.name || !b.name) return 0;\n return b.name.localeCompare(a.name);\n});\n\n// Get items older than 7 days\nconst olderItems = sortedItems.slice(7);\n\nreturn olderItems\n\n"
},
"typeVersion": 2
},
{
"id": "3a31ee24-3d6c-4340-9c5e-bb1c1cce6151",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
1740,
-160
],
"parameters": {
"width": 260,
"height": 340,
"content": "## 调试限制"
},
"typeVersion": 1
},
{
"id": "df815c43-f6f9-44b8-9503-6a8d0167b844",
"name": "便签4",
"type": "n8n-nodes-base.stickyNote",
"position": [
1440,
-160
],
"parameters": {
"width": 260,
"height": 340,
"content": "## 获取所有工作流"
},
"typeVersion": 1
},
{
"id": "c0433a5f-7f6c-4af4-bbbb-ca914aeef33f",
"name": "便签5",
"type": "n8n-nodes-base.stickyNote",
"position": [
1140,
-160
],
"parameters": {
"width": 260,
"height": 340,
"content": "## 创建新的 Google 文件夹"
},
"typeVersion": 1
},
{
"id": "adba380e-16c2-4647-a701-9d5cec1baa0f",
"name": "便签6",
"type": "n8n-nodes-base.stickyNote",
"position": [
840,
-160
],
"parameters": {
"width": 260,
"height": 340,
"content": "## 获取日期时间戳"
},
"typeVersion": 1
},
{
"id": "4041f4fb-2b51-48e7-af55-b7351a52e4ea",
"name": "便签7",
"type": "n8n-nodes-base.stickyNote",
"position": [
-160,
-160
],
"parameters": {
"color": 7,
"width": 700,
"height": 1480,
"content": "# ✨😃 自动工作流备份到 Google Drive"
},
"typeVersion": 1
}
],
"active": true,
"pinData": {},
"settings": {
"timezone": "America/Vancouver",
"callerPolicy": "workflowsFromSameOwner",
"executionOrder": "v1"
},
"versionId": "11ff8d25-bbc5-4681-b292-ac60a00fd7b0",
"connections": {
"Every Day": {
"main": [
[
{
"node": "Get DateTIme",
"type": "main",
"index": 0
}
]
]
},
"Execute Once": {
"main": [
[
{
"node": "Search Folder Names",
"type": "main",
"index": 0
},
{
"node": "Complete Message",
"type": "main",
"index": 0
}
]
]
},
"Get DateTIme": {
"main": [
[
{
"node": "Create Folder with DateTime Stamp",
"type": "main",
"index": 0
}
]
]
},
"Limit to 200": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Get Workflows": {
"main": [
[
{
"node": "Limit to 200",
"type": "main",
"index": 0
}
]
]
},
"Loop Over Items": {
"main": [
[
{
"node": "Execute Once",
"type": "main",
"index": 0
}
],
[
{
"node": "Convert Workflow to JSON File",
"type": "main",
"index": 0
}
]
]
},
"Search Folder Names": {
"main": [
[
{
"node": "Find Folders to Delete",
"type": "main",
"index": 0
}
]
]
},
"On clicking 'execute'": {
"main": [
[
{
"node": "Get DateTIme",
"type": "main",
"index": 0
}
]
]
},
"Find Folders to Delete": {
"main": [
[
{
"node": "Delete Folders",
"type": "main",
"index": 0
}
]
]
},
"Convert Workflow to JSON File": {
"main": [
[
{
"node": "Save JSON File to Google Drive Folder",
"type": "main",
"index": 0
}
]
]
},
"Create Folder with DateTime Stamp": {
"main": [
[
{
"node": "Get Workflows",
"type": "main",
"index": 0
}
]
]
},
"Save JSON File to Google Drive Folder": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 其他
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
AI 代理餐厅 [模板]
🤖 WhatsApp、Instagram 和 Messenger 的 AI 餐厅助手
If
N8n
Set
+37
239 节点Amanda Benks
其他
在可视化参考库中探索n8n节点
在可视化参考库中探索n8n节点
If
Ftp
Set
+93
113 节点I versus AI
其他
使用Google Drive、GitHub和消息警报的自动化工作流备份系统
使用Google Drive、GitHub和消息警报的自动化工作流备份系统
If
N8n
Set
+11
20 节点Khairul Muhtadin
内容创作
您喜爱频道的高级YouTube RSS Feed伙伴
通过RSS源监控喜爱的YouTube频道并接收通知
Set
Code
Gmail
+13
41 节点Joseph LePage
其他
[模板] AI宠物店 v8
🐶 AI宠物店助手 - 集成GPT-4o、Google日历和WhatsApp/Instagram/Facebook
If
N8n
Set
+38
244 节点Amanda Benks
销售
备份工作流到 GitHub(子文件夹)
备份工作流到 GitHub(子文件夹)
If
N8n
Set
+12
25 节点Nazmy
其他
工作流信息
难度等级
高级
节点数量22
分类1
节点类型12
作者
Joseph LePage
@joeAs an AI Automation consultant based in Canada, I partner with forward-thinking organizations to implement AI solutions that streamline operations and drive growth.
外部链接
在 n8n.io 查看 →
分享此工作流