Design in n8n

Hi,

I have a task to redesign one of the legacy job - which checks for certain files name starting with XYZ* on a sftp server, need to check periodically, warn if file not gotten on that day, stop looking if already downloaded.

I am planning to redesign in n8n.

Any feedback on how I can implement this?

The workflow would get triggered by a Cron-Node.
Because there is no built-in functionality to list only files that start with a given string. So you would have to get all the files and then do the filtering of the files yourself. Either with an IF-Node or a Function-Node.
That result you can then use in another IF-Node which then either sends the message (Email, Slack, Mattermost, …) or does nothing.
That should be it.

Hi,

As You suggested, used list operation in sftp, and used IF to check, workflow is crashing when I connected IF to FTP to download the matched file. I thought its crashing because of multiple files matched condition, tried with 1 file, same result. Any clues?

Error - workflow execution process is crashed for unknown reasons.

Is it possible that your machine has to less memory and that is why the process is crashing?

incase, IF node has results, its failing. I think it has enough memory. Is there a log I can check to see reason for crash?

No, but you should see in the editor-ui till where it executes and on which node it crashes.

its crashing after executing IF node. IF node results are shown. but not entering FTP node to download.

If you can see the result of the IF-Node then the FTP-Node will be the problem. How many entries are you sending into the FTP-Node? Are you just doing list or do you actually download the files?

actually downloading files whatever passed IF node. passing node[“IF”].json[“name”] to path for ftp download.

Then I guess that is the problem. The files are probably large, it runs out of memory and crashes.

they are simple text files I have put it for testing. not even KB.

A memory issue is the only thing I can think of right now that would crash a process like this.

image

this is the error shown in the console.

Finally resolved issue. when I manually tried connecting to sftp, I got prompt to add host. after that it resolved issues. Weird is list worked fine without complaining.

As always, thanks for helping out. Another question is, how do we check status of download or upload from ftp component? If its success or not.

If it does not work the node should fail and the workflow so stop.

image

Getting this error. First sftp with list command is success, and its always second sftp command failing. Do you think its not able to open another connection or is it trying to get hold of the same connection for second ftp…

I checked now. For me it is working fine when multiple FTP-Nodes get chained. Wonder what is different for you.

Every node is working by itself. Meaning it opens its own connection and closes it once it is done. So n8n should theoretically never use more than one FTP-connection at any given time.