Extracting and manipulating data with node exec

Hello everyone, everything good?
I'm not a programmer, I'm from the computer network area, I have a problem with a flow, I'll try to explain what it does, I want it to read the files from inside the folder c:\fotos\3, after reading the files , it plays one by one for "http://"+192.168.200.13:1880/3/+filename/" if there is only one file inside the folder, it works, but if there are more than 1, it plays all files in one link, can you help me with this? Thank you very much!!!! below I will post my flow

[
    {
        "id": "6729132ba69e35f1",
        "type": "tab",
        "label": "Flow 20",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "254844678aac9bd3",
        "type": "exec",
        "z": "6729132ba69e35f1",
        "command": "dir",
        "addpay": "filename",
        "append": "",
        "useSpawn": "false",
        "timer": "5",
        "winHide": false,
        "oldrc": false,
        "name": "Exec",
        "x": 730,
        "y": 360,
        "wires": [
            [
                "d5f92713a738f11d"
            ],
            [],
            []
        ]
    },
    {
        "id": "a7c10d94fb83f8cf",
        "type": "function",
        "z": "6729132ba69e35f1",
        "name": "function 12",
        "func": "var ipservidor = \"192.168.200.13\";\nvar id = msg.payload.id;\n\n\nmsg.filename = \"c:\\\\fotos\\\\\"+id+\"\\\\\"+\"/b\";\nmsg.url = \"http://\"+ipservidor+\":1880/\"+id+\"/\";\n\n\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 530,
        "y": 360,
        "wires": [
            [
                "254844678aac9bd3"
            ]
        ]
    },
    {
        "id": "d5f92713a738f11d",
        "type": "function",
        "z": "6729132ba69e35f1",
        "name": "",
        "func": "var urlfotos = msg.url;\nvar nomesarquivos = msg.payload;\n\n\nvar urlcompleta = msg.url+msg.payload;\n\n\nmsg.urlcompleta = urlcompleta;\n\n\nreturn msg;\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 920,
        "y": 360,
        "wires": [
            [
                "00fe6360698f84d8"
            ]
        ]
    },
    {
        "id": "00fe6360698f84d8",
        "type": "debug",
        "z": "6729132ba69e35f1",
        "name": "debug 26",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 1100,
        "y": 360,
        "wires": []
    },
    {
        "id": "1dbb92b370aff561",
        "type": "inject",
        "z": "6729132ba69e35f1",
        "name": "",
        "props": [
            {
                "p": "payload.id",
                "v": "3",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "x": 330,
        "y": 360,
        "wires": [
            [
                "a7c10d94fb83f8cf"
            ]
        ]
    }
]

I want it to read the files from inside the folder c:\fotos\3

Where are you reading the files? Are the files on the device running NR? if so you could use one of the file nodes.

Put a debug node on the output of your function node and show what it returns.

There’s a great page in the docs (Working with messages : Node-RED) that will explain how to use the debug panel to find the right path to any data item.

Pay particular attention to the part about the buttons that appear under your mouse pointer when you over hover a debug message property in the sidebar.

BX00Cy7yHi

Thanks for the answer.
Hello friend, yes I use the debugs in the outputs, as it is in my flow, below I will send an image of the return. I'm using exec-node to read the files.

  1. Could you answer ALL the questions I asked.
  2. please set the debug node to display the complete msg object and attach it to the output of the exec node.

Alright I'm answering now.

1: I'm reading the files from the directory "c:\fotos\3" in the WINDOWS operating system, where node-red is running.

2: Are the files on the device running NR? --- This one I don't understand.

The debug already had a complete msg, but it was in the output of the function, I put it in the exec node, below I send the image.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.