AutomationFlowsGeneral › Executecommand

Executecommand

ExecuteCommand. Uses start, executeCommand, readBinaryFile. Manual trigger; 6 nodes.

Manual trigger★★★★☆ complexity6 nodesStartExecute CommandRead Binary File
General Trigger: Manual Nodes: 6 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
{
  "createdAt": "2021-03-04T11:22:05.930Z",
  "updatedAt": "2021-03-04T11:24:54.336Z",
  "id": "103",
  "name": "ExecuteCommand",
  "active": false,
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        250,
        300
      ],
      "id": "596a5418-e61d-41ab-84eb-64e07630b23e"
    },
    {
      "parameters": {
        "command": "=echo 'test' > /tmp/{{$node[\"Set\"].json[\"filename\"]}}"
      },
      "name": "Execute Command",
      "type": "n8n-nodes-base.executeCommand",
      "typeVersion": 1,
      "position": [
        660,
        300
      ],
      "notesInFlow": true,
      "notes": "write file to /tmp",
      "id": "9c118fb2-edad-441a-b8a8-f1c843a37bd5"
    },
    {
      "parameters": {
        "filePath": "=/tmp/{{$node[\"Set\"].json[\"filename\"]}}"
      },
      "name": "Read Binary File",
      "type": "n8n-nodes-base.readBinaryFile",
      "typeVersion": 1,
      "position": [
        860,
        300
      ],
      "notesInFlow": true,
      "notes": "read file",
      "id": "af6e6941-e34e-4b5d-a236-3bccd5bd4cfd"
    },
    {
      "parameters": {
        "values": {
          "string": [
            {
              "name": "filename",
              "value": "=filename{{Date.now()}}"
            }
          ]
        },
        "options": {}
      },
      "name": "Set",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [
        450,
        300
      ],
      "notesInFlow": true,
      "notes": "generate filename",
      "id": "8864d17b-8310-4460-810c-d43da4e967ff"
    },
    {
      "parameters": {
        "functionCode": "testData= 'dGVzdAo='\nif($node['Execute Command'].json['exitCode']!==0 || items[0].binary.data.data !== testData){\n  throw new Error('Error Execute Command in node');\n}\nreturn items;"
      },
      "name": "Function",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        1050,
        300
      ],
      "notesInFlow": true,
      "notes": "verify file content",
      "id": "0a60312c-4030-496b-ad24-3acebff5eca1"
    },
    {
      "parameters": {
        "command": "=rm /tmp/{{$node[\"Set\"].json[\"filename\"]}}"
      },
      "name": "Execute Command1",
      "type": "n8n-nodes-base.executeCommand",
      "typeVersion": 1,
      "position": [
        1250,
        300
      ],
      "notesInFlow": true,
      "notes": "remove file from /tmp",
      "id": "ede3e595-c571-4155-85bd-14e39fe78049"
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "Set",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute Command": {
      "main": [
        [
          {
            "node": "Read Binary File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set": {
      "main": [
        [
          {
            "node": "Execute Command",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Binary File": {
      "main": [
        [
          {
            "node": "Function",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Function": {
      "main": [
        [
          {
            "node": "Execute Command1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {},
  "staticData": null,
  "meta": null,
  "versionId": null,
  "triggerCount": 0,
  "tags": []
}
Pro

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

About this workflow

ExecuteCommand. Uses start, executeCommand, readBinaryFile. Manual trigger; 6 nodes.

Source: https://github.com/n8n-io/test-workflows/blob/c1d376431a818f81f44e9ce645b8fb4878805419/workflows/103.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

NextCloud:NextCloud:Folder:create move copy delete list:File:upload move copy download delete. Uses start, nextCloud, readBinaryFile. Manual trigger; 28 nodes.

Start, Next Cloud, Read Binary File
General

Zulip:Message:sendPrivate update updateFile sendStream get delete:Stream:create getAll getSubscribed update delete:user:getAll get update. Uses start, zulip, readBinaryFile. Manual trigger; 19 nodes.

Start, Zulip, Read Binary File
General

EditImage:ALL. Uses start, editImage, readBinaryFile. Manual trigger; 14 nodes.

Start, Edit Image, Read Binary File
General

S3:Bucket:create getAll search:File:upload getAll download copy delete:Folder:create getAll delete. Uses start, s3, readBinaryFile. Manual trigger; 14 nodes.

Start, S3, Read Binary File
General

Backup workflows & credentials. Uses start, executeCommand. Manual trigger; 13 nodes.

Start, Execute Command