Skip to content


Using WINSCP to download directly from an SFTP site – delete file after.

Lewis asked 5 years ago
I’m currently using WINSCP to download directly from an SFTP site.  I would like to delete the file after download, how can that be done?
What code needs to be added to the script from the article below?
Thank you
Lorren answered 5 years ago
I have not found a method in WINScp to allow for deleting a single file. The only thing I see that could be done is to call the RemoveFiles method after transferring the files from the server.
For Each transfer as WinSCP.TransferEventArgs in transferResult.Transfers 
‘New Line using whatever file extension is being downloaded
session.RemoveFiles(DownloadFolder & “*.xml”)
Anthony Walsh answered 5 years ago
I have a section in our .ps1 file that reads:
That said, I cannot confirm it is working.  I’m actually struggling with the base set up of the SmartConnect Map.  I’m using a Bulk Data Load type with a Folder Data Source.  Every time I open the map I get a message that source could not be validated.  What are the proper Data Source settings on a map that is using tasks to go get the actual source file?  I’m a newbie so my apologies for asking any dumb questions.  Thanks.

If you would like to submit an answer or comment, please sign in to the eOne portal.