Download and delete file on SFTP server

Hello,

I must download file from SFTP server and delete them on server so as not to download them again next time.

I use “File transfert” to download files.
image

After I use SSH command to delete them.
image

But nothing is happening. No error.

I try with winscp. I can delete files in SFTP GUI but I can’t open terminal.
My user don’t have enought right to run command by SSH.

How can I delete these files with EasyMorph?
Should I drive winscp directly with EasyMorph?
It would be a shame for such a common operation that download files on SFTP.

Thank you for your help.

I was able to delete remote files after downloading them by running winscp from command line.
But in case there is an error, I have no way to clean remote folder properly.

Am I understanding it correctly that using SSH Command didn’t work, but using Run Program to run WinSCP that uses the same credentials as SSH Command worked?

In EasyMorph:

  • "File tranfer" with SFTP works but not delete file on server.
  • "SSH command" doesn't work.

For more details on this issue, I try to use WinSCP.

  • GUI work in SFTP protocol.
  • With command (SSH shell), connection is refused.

image

Since I can delete files on remote server only using SFTP, I am driving WinSCP with EasyMorph to do this operation via SFTP.

I use PowerShell action:
image

With commands:

& "C:\WinSCP\WinSCP.com" {Log} /ini=nul
/command "open sftp://{User}:{Password}@{Server_Adress}/ -hostkey=""{fingerprint}"""
"rm {File}" `
"exit"

It's complicated just to go and delete file that was downloaded and in case of an error, I don't really have an easy way not to download this file again. It will be integrated twice.

An option to remove file downloaded on "File tranfer" would be simpler.

Do you have another solution?

Starting from version 5.4.1, the “File transfer” action can delete files.

image