Get filename of created files from exec

Hi!

I have a java program which is triggered by the exec node.
The output of it are several files with different names. (automatically generated with timestamp in the name)

How would I get these names, then transfer them to a server via SFTP and afterwards delete them on the local server?
Alternatively, it would be ok to say "move all files starting with "XYZ_"" cause all of them start the same.

Thanks!

Can you show us what the exec node produces by adding a debug node?

The program just puts out some warnings from the java file as well as: {"code":0}
But no filenames or so.

Can you post your flow?

Yes, do that.

Any idea how I would do this? Is there a node to get all files in a folder and then filter them?

You could use the exec node to move the files using command line arguments.

On Linux:

cp --help

Ok did it the following way now:

[
    {
        "id": "b2ff03a7268c4151",
        "type": "tab",
        "label": "SECRET",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "783c455e1d595834",
        "type": "exec",
        "z": "b2ff03a7268c4151",
        "command": "doesntmatter",
        "addpay": "",
        "append": "",
        "useSpawn": "false",
        "timer": "",
        "winHide": false,
        "oldrc": false,
        "name": "",
        "x": 550,
        "y": 160,
        "wires": [
            [
                "cea0cc643dbd4ffe"
            ],
            [],
            []
        ]
    },
    {
        "id": "297602128150a085",
        "type": "inject",
        "z": "b2ff03a7268c4151",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 140,
        "y": 160,
        "wires": [
            [
                "783c455e1d595834"
            ]
        ]
    },
    {
        "id": "cda84830c6810720",
        "type": "sftp in",
        "z": "b2ff03a7268c4151",
        "name": "anypath",
        "sftp": "",
        "operation": "put",
        "filename": "",
        "localFilename": "",
        "workdir": "/anypath",
        "x": 680,
        "y": 300,
        "wires": [
            [
                "e2b4c85b292843c4"
            ]
        ]
    },
    {
        "id": "cea0cc643dbd4ffe",
        "type": "fs-file-lister",
        "z": "b2ff03a7268c4151",
        "name": "",
        "start": "/anypath",
        "pattern": "ABC_*",
        "folders": "*",
        "hidden": true,
        "lstype": "files",
        "path": false,
        "single": false,
        "depth": 0,
        "stat": false,
        "showWarnings": true,
        "x": 240,
        "y": 240,
        "wires": [
            [
                "165da27c15677898"
            ]
        ]
    },
    {
        "id": "165da27c15677898",
        "type": "change",
        "z": "b2ff03a7268c4151",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "temp",
                "pt": "msg",
                "to": "payload",
                "tot": "msg",
                "dc": true
            },
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "{}",
                "tot": "json"
            },
            {
                "t": "set",
                "p": "payload.data",
                "pt": "msg",
                "to": "\"/somepath\" & msg.temp",
                "tot": "jsonata"
            },
            {
                "t": "set",
                "p": "payload.filename",
                "pt": "msg",
                "to": "temp",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 460,
        "y": 300,
        "wires": [
            [
                "cda84830c6810720"
            ]
        ]
    },
    {
        "id": "e2b4c85b292843c4",
        "type": "fs-ops-delete",
        "z": "b2ff03a7268c4151",
        "name": "",
        "path": "/anypath/",
        "pathType": "str",
        "filename": "temp",
        "filenameType": "msg",
        "x": 870,
        "y": 300,
        "wires": [
            []
        ]
    }
]

Thanks for your support

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