SFTP Delete file Node Error

I’m using the SFTP node to delete a file in a folder after I have processed it. It successfully deletes the file but returns an error. See Below

If I use the fixed value for the path of this particular document it actually gives me a different error. Again it deletes the file, but the node shows error.

Hey @Philip_Wiggins,

That is odd the first error is saying the input is empty which I would expect if you had multiple items but it looks to be only one.

The second error says the file isn’t there which is something else I would expect if the file had been deleted and it is trying to delete it again.

Are you doing any looping in your workflow and for that second error did the file exist before the deletion attempt?

Looking again at that second error the path displayed isn’t the path in the box there seems to be 2 in there with a space or new line character f between them.

Can you share the workflow you are using and the version of n8n?

Ok. I think I see the issue based on your comment. There are 2 items in node, but they come from a txt file that I’m deleting at the end so its trying to delete the one txt file twice. How would I change the flow to both delete the file last and only try to delete once. The flow code is below as well as a screen shot of the run flow.

Hey @Philip_Wiggins,

What does the output of “Remove Non Status Data Records” look like? I have a feeling just setting the SFTP node at the end to only run once might do the job.

This is the output. Yea, I only need it to run once at end, but just not sure how to make that happen.

[
  {
    "type": "-",
    "name": "mail_tracking.txt",
    "size": 940,
    "modifyTime": "2022-09-29T08:21:19.000Z",
    "accessTime": "2022-09-29T08:21:19.000Z",
    "rights": {
      "user": "rwx",
      "group": "rx",
      "other": ""
    },
    "path": "/Data_From_CD/mail_tracking.txt"
  }
]

Perfect, If you open the node and click the little cog on the right there should be some other settings, One of those will be to Execute Once.

image

1 Like