AutomationFlowsGeneral › Backup N8n Workflows to /code

Backup N8n Workflows to /code

Backup n8n Workflows to /code. Uses executeCommand. Scheduled trigger; 2 nodes.

Cron / scheduled trigger★☆☆☆☆ complexity2 nodesExecute Command
General Trigger: Cron / scheduled Nodes: 2 Complexity: ★☆☆☆☆ Added:

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "Backup n8n Workflows to /code",
  "nodes": [
    {
      "parameters": {
        "cronExpression": "0 0 * * *",
        "options": {}
      },
      "name": "Nightly Cron",
      "type": "n8n-nodes-base.cron",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "command": "mkdir -p /code/Automation/n8n\n# Check /code is a mountpoint (returns 0 if mounted)\nif mountpoint -q /code; then\n  # Try exporting all workflows into a single file; fall back to per-workflow export if CLI differs\n  if command -v n8n >/dev/null 2>&1; then\n    n8n export:workflow --all --output=/code/Automation/n8n/workflows.json || n8n export:workflow --all --separate --output=/code/Automation/n8n\n  else\n    echo \"n8n CLI not available; aborting export\"\n    exit 1\n  fi\nelse\n  echo \"/code is not mounted; skipping export\"\n  exit 0\nfi"
      },
      "name": "Export Workflows",
      "type": "n8n-nodes-base.executeCommand",
      "typeVersion": 1,
      "position": [
        450,
        300
      ]
    }
  ],
  "connections": {
    "Nightly Cron": {
      "main": [
        [
          {
            "node": "Export Workflows",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {},
  "tags": []
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Backup n8n Workflows to /code. Uses executeCommand. Scheduled trigger; 2 nodes.

Source: https://github.com/kflanagan/Automation/blob/6c5638379329d537aa016166587c727ee98bf030/n8n/backup-workflows.json — original creator credit. Request a take-down →

More General workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

General

HikeWise Swarm Trigger. Uses executeCommand. Scheduled trigger; 5 nodes.

Execute Command
General

HikeWise Release. Uses executeCommand. Scheduled trigger; 4 nodes.

Execute Command
General

Scraper VC. Uses executeCommand. Scheduled trigger; 3 nodes.

Execute Command
General

ContextIQ Google Drive Sync. Uses executeCommand. Scheduled trigger; 2 nodes.

Execute Command
General

Complete backup solution that saves both workflows and credentials to local/server disk with optional FTP upload for off-site redundancy.

Read Write File, Email Send, Execute Command +3