Hi,
I'm trying to get all files from a folder on a server via sftp and download them into a specific local folder.
If possible, I'd only like to download those files that start with XYC.
I tried the following flow, but am only getting the buffer of those files. How would I either set the local folder where the files should be stored or use the "write file" function to store all files? (there will always be multiple files, so I can not set a filename in the "write file" function)
[
{
"id": "e72b337e9c7f6a48",
"type": "debug",
"z": "a69da9d2e0a258af",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 1130,
"y": 120,
"wires": []
},
{
"id": "8c9f3d4c732120fe",
"type": "sftp in",
"z": "a69da9d2e0a258af",
"name": "",
"sftp": "",
"operation": "get",
"filename": "",
"localFilename": "",
"workdir": "/root/transfer/in/",
"x": 930,
"y": 240,
"wires": [
[
"e72b337e9c7f6a48"
]
]
},
{
"id": "e44b9fe017c1de25",
"type": "change",
"z": "a69da9d2e0a258af",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "\"/sample\" & msg.payload.name",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 760,
"y": 240,
"wires": [
[
"8c9f3d4c732120fe"
]
]
},
{
"id": "99ff4c9b2c5eafdb",
"type": "debug",
"z": "a69da9d2e0a258af",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload.name",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 730,
"y": 320,
"wires": []
},
{
"id": "dfec3f0ea75af213",
"type": "split",
"z": "a69da9d2e0a258af",
"name": "Split message to file names",
"splt": "\\n",
"spltType": "str",
"arraySplt": 1,
"arraySpltType": "len",
"stream": false,
"addname": "",
"x": 500,
"y": 260,
"wires": [
[
"99ff4c9b2c5eafdb",
"e44b9fe017c1de25"
]
]
},
{
"id": "c8dc3ac050ba705d",
"type": "sftp in",
"z": "a69da9d2e0a258af",
"name": "",
"sftp": "",
"operation": "list",
"filename": "",
"localFilename": "",
"workdir": "/sample/",
"x": 290,
"y": 260,
"wires": [
[
"dfec3f0ea75af213"
]
]
},
{
"id": "caa682de3c9ad73f",
"type": "inject",
"z": "a69da9d2e0a258af",
"name": "",
"props": [
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 110,
"y": 260,
"wires": [
[
"c8dc3ac050ba705d"
]
]
}
]
Thanks!