8
n8n 中文网amn8n.com

将所有n8n工作流备份到Nextcloud

中级

这是一个DevOps领域的自动化工作流,包含 13 个节点。主要使用 N8n, Set, Code, Sort, NextCloud 等节点。 n8n工作流备份至Nextcloud(7天保留期)

前置要求
  • 无特殊前置要求,导入即可使用
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "zRClo7KNaDEE4DX4",
  "meta": {
    "instanceId": "30c75264a206eec49d4c38a892fd65da80b5ccd70231d5bfaa83c4000c45aa34",
    "templateId": "2886",
    "templateCredsSetupCompleted": true
  },
  "name": "将所有 N8N 工作流备份到 Nextcloud",
  "tags": [
    {
      "id": "EJHl0q84mJeIEahG",
      "name": "workflow",
      "createdAt": "2025-05-23T09:08:42.007Z",
      "updatedAt": "2025-05-23T09:08:42.007Z"
    },
    {
      "id": "d1DSOdv8d9pvLBYb",
      "name": "nextcloud",
      "createdAt": "2025-05-17T10:11:35.387Z",
      "updatedAt": "2025-05-17T10:11:35.387Z"
    },
    {
      "id": "gDg68LgsJk4I3EeF",
      "name": "automat",
      "createdAt": "2025-05-17T10:12:05.228Z",
      "updatedAt": "2025-05-17T10:12:05.228Z"
    },
    {
      "id": "i5XN21jDEYfjUw07",
      "name": "n8n",
      "createdAt": "2025-05-23T09:08:34.979Z",
      "updatedAt": "2025-05-23T09:08:34.979Z"
    },
    {
      "id": "wBKhtn9d0XBan4YD",
      "name": "backup",
      "createdAt": "2025-05-17T10:11:27.752Z",
      "updatedAt": "2025-05-17T10:11:48.917Z"
    }
  ],
  "nodes": [
    {
      "id": "5a95d578-fa4a-400f-9f4c-e0263484831e",
      "name": "点击“执行”时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        300,
        420
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "502e7322-74c1-4fce-933d-73628215adb6",
      "name": "n8n",
      "type": "n8n-nodes-base.n8n",
      "position": [
        900,
        540
      ],
      "parameters": {
        "filters": {},
        "requestOptions": {}
      },
      "credentials": {
        "n8nApi": {
          "id": "LYaHoFhh0W98ao9P",
          "name": "n8n account"
        }
      },
      "retryOnFail": true,
      "typeVersion": 1,
      "alwaysOutputData": true
    },
    {
      "id": "2a7c2c11-30ab-4e4b-b1c8-bd5a4ecaac11",
      "name": "遍历项目",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        1160,
        540
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "edcf141d-98ae-4f8f-9640-205eb33ae868",
      "name": "转换为文件",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        1400,
        560
      ],
      "parameters": {
        "options": {
          "format": true,
          "fileName": "={{ $json.name + \".json\" }} "
        },
        "operation": "toJson"
      },
      "typeVersion": 1.1
    },
    {
      "id": "8e3dd7ae-18dd-4389-920e-ff37a83685c3",
      "name": "备份",
      "type": "n8n-nodes-base.sort",
      "notes": "Backup List",
      "position": [
        1080,
        340
      ],
      "parameters": {
        "options": {},
        "sortFieldsUi": {
          "sortField": [
            {
              "order": "descending",
              "fieldName": "=path"
            }
          ]
        }
      },
      "notesInFlow": true,
      "typeVersion": 1
    },
    {
      "id": "e1e8f61c-a6fb-4982-a141-6326bdc03df1",
      "name": "定时触发器",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        300,
        640
      ],
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "5ec178d4-99ac-4dc0-91ff-bdd4e5a18212",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        260,
        240
      ],
      "parameters": {
        "color": 5,
        "width": 1520,
        "height": 680,
        "content": "## N8N 备份流程"
      },
      "typeVersion": 1
    },
    {
      "id": "d8aa50c8-123b-44be-8777-53bdb50557d9",
      "name": "备份路径",
      "type": "n8n-nodes-base.set",
      "notes": "Backupdirectory",
      "position": [
        500,
        540
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "bd7c7d59-267d-4201-bfe9-e9ef478557a2",
              "name": "backup",
              "type": "string",
              "value": "=/N8N-Backup/{{ $now.format('yyyy-MM-dd_HHmmss') }}"
            }
          ]
        }
      },
      "executeOnce": true,
      "notesInFlow": true,
      "typeVersion": 3.4
    },
    {
      "id": "f808618a-6677-4fc9-8227-f5e5acc96bdf",
      "name": "Nextcloud 目录",
      "type": "n8n-nodes-base.nextCloud",
      "notes": "Create Directory",
      "position": [
        700,
        540
      ],
      "parameters": {
        "path": "={{ $json.backup }}",
        "resource": "folder"
      },
      "credentials": {
        "nextCloudApi": {
          "id": "RVy0PR1u6vaBvQL0",
          "name": "NextCloud account 2"
        }
      },
      "notesInFlow": true,
      "typeVersion": 1
    },
    {
      "id": "1f179a8c-0af6-4510-b9aa-f928b91525f4",
      "name": "Nextcloud 上传",
      "type": "n8n-nodes-base.nextCloud",
      "position": [
        1620,
        560
      ],
      "parameters": {
        "path": "={{ $('Backup Path').item.json.backup }}/{{ $binary.data.fileName }}",
        "binaryDataUpload": true
      },
      "credentials": {
        "nextCloudApi": {
          "id": "RVy0PR1u6vaBvQL0",
          "name": "NextCloud account 2"
        }
      },
      "typeVersion": 1,
      "alwaysOutputData": true
    },
    {
      "id": "efaa98ff-efe8-4d2c-8496-21f259620f87",
      "name": "Nextcloud 列出目录",
      "type": "n8n-nodes-base.nextCloud",
      "position": [
        900,
        340
      ],
      "parameters": {
        "path": "/N8N-Backup",
        "resource": "folder",
        "operation": "list"
      },
      "credentials": {
        "nextCloudApi": {
          "id": "RVy0PR1u6vaBvQL0",
          "name": "NextCloud account 2"
        }
      },
      "executeOnce": true,
      "retryOnFail": false,
      "typeVersion": 1,
      "alwaysOutputData": false
    },
    {
      "id": "aeb2430a-c6af-4583-97ea-1fcbdc596e6a",
      "name": "限制备份",
      "type": "n8n-nodes-base.code",
      "notes": "Retention 7 ",
      "position": [
        1280,
        340
      ],
      "parameters": {
        "jsCode": "// Behalte nur Items ab Index 7 (ältere Einträge)\nreturn items.slice(7);\n"
      },
      "notesInFlow": true,
      "typeVersion": 2
    },
    {
      "id": "650e7660-3c1c-48f0-983e-76d9b76f8857",
      "name": "Nextcloud - 删除旧备份",
      "type": "n8n-nodes-base.nextCloud",
      "notes": "Delete old Backups",
      "position": [
        1480,
        340
      ],
      "parameters": {
        "path": "={{ $json.path }}",
        "resource": "folder",
        "operation": "delete"
      },
      "credentials": {
        "nextCloudApi": {
          "id": "RVy0PR1u6vaBvQL0",
          "name": "NextCloud account 2"
        }
      },
      "notesInFlow": true,
      "retryOnFail": false,
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {},
  "versionId": "afcc5219-1d3c-47c9-8751-4db56d769de3",
  "connections": {
    "n8n": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Backups": {
      "main": [
        [
          {
            "node": "Limits Backups",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Backup Path": {
      "main": [
        [
          {
            "node": "Nextcloud Directory",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Limits Backups": {
      "main": [
        [
          {
            "node": "Nextcloud - Delete old backups",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert to File": {
      "main": [
        [
          {
            "node": "Nextcloud Upload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "Nextcloud List Dir",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Convert to File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Nextcloud Upload": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Backup Path",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Nextcloud List Dir": {
      "main": [
        [
          {
            "node": "Backups",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Nextcloud Directory": {
      "main": [
        [
          {
            "node": "n8n",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On clicking 'execute'": {
      "main": [
        [
          {
            "node": "Backup Path",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Nextcloud - Delete old backups": {
      "main": [
        []
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 开发运维

需要付费吗?

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

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

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

作者
Joachim Hummel

Joachim Hummel

@jhummel

Automation consultant with 30+ years of IT experience. Specialized in building efficient workflows with n8n for freelancers and small to medium-sized businesses.

外部链接
在 n8n.io 查看

分享此工作流