AutomationFlowsGeneral › Execute Commands from Text File Inputs

Execute Commands from Text File Inputs

Original n8n title: Execute Multiple Command Lines Based on Text File Inputs

Execute Multiple Command Lines Based On Text File Inputs. Uses manualTrigger, readBinaryFile, moveBinaryData, executeCommand. Event-driven trigger; 7 nodes.

Event trigger★★★★☆ complexity7 nodesRead Binary FileMove Binary DataExecute Command
General Trigger: Event Nodes: 7 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
{
  "nodes": [
    {
      "name": "On clicking 'execute'",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        250,
        300
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "name": "Read Binary File",
      "type": "n8n-nodes-base.readBinaryFile",
      "position": [
        440,
        300
      ],
      "parameters": {
        "filePath": "/home/n8n/filelist.txt"
      },
      "typeVersion": 1
    },
    {
      "name": "Move Binary Data",
      "type": "n8n-nodes-base.moveBinaryData",
      "position": [
        610,
        300
      ],
      "parameters": {
        "options": {},
        "setAllData": false
      },
      "typeVersion": 1
    },
    {
      "name": "Function",
      "type": "n8n-nodes-base.function",
      "position": [
        810,
        300
      ],
      "parameters": {
        "functionCode": "items[0].json.arrData = items[0].json.data.split(\"\\n\");\nitems[0].json.data = {};\nitems[0].json.dataSize = items[0].json.arrData.length-2;\nreturn items;"
      },
      "typeVersion": 1
    },
    {
      "name": "Execute Command",
      "type": "n8n-nodes-base.executeCommand",
      "position": [
        1040,
        300
      ],
      "parameters": {
        "command": "=echo \"The file name is {{$node[\"Function\"].json[\"arrData\"][$runIndex]}}\" >> /home/n8n/n8n-output.txt"
      },
      "typeVersion": 1
    },
    {
      "name": "IF",
      "type": "n8n-nodes-base.if",
      "position": [
        1250,
        520
      ],
      "parameters": {
        "conditions": {
          "number": [
            {
              "value1": "={{$node[\"Function\"].json[\"dataSize\"]}}",
              "value2": "={{$runIndex}}",
              "operation": "larger"
            }
          ],
          "string": []
        }
      },
      "typeVersion": 1
    },
    {
      "name": "NoOp",
      "type": "n8n-nodes-base.noOp",
      "position": [
        1450,
        540
      ],
      "parameters": {},
      "typeVersion": 1
    }
  ],
  "connections": {
    "IF": {
      "main": [
        [
          {
            "node": "Execute Command",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "NoOp",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Function": {
      "main": [
        [
          {
            "node": "Execute Command",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute Command": {
      "main": [
        [
          {
            "node": "IF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Move Binary Data": {
      "main": [
        [
          {
            "node": "Function",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Binary File": {
      "main": [
        [
          {
            "node": "Move Binary Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On clicking 'execute'": {
      "main": [
        [
          {
            "node": "Read Binary File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Pro

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

About this workflow

Execute Multiple Command Lines Based On Text File Inputs. Uses manualTrigger, readBinaryFile, moveBinaryData, executeCommand. Event-driven trigger; 7 nodes.

Source: https://github.com/Zie619/n8n-workflows — 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

Simple File Based Key Value Store Getkey. Uses manualTrigger, functionItem, readBinaryFile, moveBinaryData. Event-driven trigger; 5 nodes.

Function Item, Read Binary File, Move Binary Data
General

Standup Bot 2 4 Read Config. Uses manualTrigger, readBinaryFile, moveBinaryData. Event-driven trigger; 3 nodes.

Read Binary File, Move Binary Data
General

Standup Bot - Read Config. Uses manualTrigger, readBinaryFile, moveBinaryData. Event-driven trigger; 3 nodes.

Read Binary File, Move Binary Data
General

Using n8n a lot?

Execute Workflow Trigger, XML, Move Binary Data +1
General

creda. Uses executeCommand, googleDrive, n8n. Event-driven trigger; 27 nodes.

Execute Command, Google Drive, n8n