Sftp file transfer script task

I want to connect to sftp server and transfer a file using SSIS.
I tried the ftp connection and it fails.
How can I do this using a script task.
I'm not very good with scripts. Can you provide me with a working script?

Thanks,

where is this file located? within your network or some other remote location where you need to use username and password?

SSIS does not have native support for sFTP - and Windows does not have native support either. This means you will need an sFTP client installed on your workstation and on the server - preferably installed to the same location.

I utilize WinSCP and install to the default location.

Once you have that available - then you can utilize either an execute process task or a script task or a combination (script task to build the sftp commands - process task to run, or script task with the WinSCP .NET library).

WinSCP site has plenty of examples - including an SSIS example using the WinSCPnet.dll.

I have used the following extensively for SSH/SFTP via script tasks in SSIS.

Here is a link with details on how to use it but not with SSIS directly.

You can take the code and apply it to SSIS. I did the same thing and it takes a little time but once setup, works great.

Free too.