FTP List and Download specific files

Hello.

I have a FTP node that lists the files inside of a directory.

I want from that list to pass the data to another FTP node to download them but only the data of specific files.

For example here is a json from FTP List

[
{
"type": "-",
"name": "mk0410.dat",
"size": 702,
"modifyTime": "2021-10-04T13:07:13.000Z",
"accessTime": "2021-10-04T13:07:20.000Z",
"rights": {
"user": "rw",
"group": "r",
"other": "r"
},
"owner": 0,
"group": 0,
"path": "/root/testemail/mk0410.dat"
},
{
"type": "-",
"name": "mk0410.csv.txt",
"size": 740,
"modifyTime": "2021-10-04T13:07:13.000Z",
"accessTime": "2021-10-04T13:07:20.000Z",
"rights": {
"user": "rw",
"group": "r",
"other": "r"
},
"owner": 0,
"group": 0,
"path": "/root/testemail/mk0410.csv.txt"
},
{
"type": "-",
"name": "dim0410.csv.txt",
"size": 740,
"modifyTime": "2021-10-04T13:07:13.000Z",
"accessTime": "2021-10-04T13:07:20.000Z",
"rights": {
"user": "rw",
"group": "r",
"other": "r"
},
"owner": 0,
"group": 0,
"path": "/root/testemail/dim0410.csv.txt"
},
{
"type": "-",
"name": "mk0410.txt",
"size": 2431,
"modifyTime": "2021-10-04T13:07:13.000Z",
"accessTime": "2021-10-04T13:07:20.000Z",
"rights": {
"user": "rw",
"group": "r",
"other": "r"
},
"owner": 0,
"group": 0,
"path": "/root/testemail/mk0410.txt"
}
]

I want to download only the files that are .csv.txt

Can someone show me how to create a function to get only the .csv.txt files and pass it to FTP Download node?

Hey @Mulen,

Something like this would do it…

image

So we do an FTP list then run an If on the filename and if it ends with .csv.txt we download it, The snippet below should help.

3 Likes

You are amazing.

Thank you very much!

1 Like