Download SFTP files using ssis

reddy421 26 Reputation points
2022-11-21T19:52:00.03+00:00

I have files sitting in an SFTP location and I am trying to bring them to a shared drive using SSIS.
The problem with SSIS is that it has a task for FTP but not for SFTP.

Here is what I did for now.
I created an SSIS Package and used an execute process task to get this working.
I copied the WinSCP executable on my DEV server and I am using this in my Executable as shown in the pic below.
262758-1.png
In my Arguments, I am using a txt file that has the SFTP HostName, Password, Source Path, TargetPath, and FileName to get the files downloaded.
When I run this, my SFTPfiles are getting downloaded in the specified path(C:\Users\kumarp\Documents)
My File names will be dynamic every day. For today it is DD_Adjustment_HOLY_2022-11-21.csv and tomorrow it will be DD_Adjustment_HOLY_2022-11-22.csv.
Can you help me with how I can change the file names in the .txt dynamically daily if this is the right approach to download the files from SFTP?
262801-2.png
If not I will also welcome any better ideas.

SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,703 questions
0 comments No comments
{count} votes

Accepted answer
  1. ZoeHui-MSFT 41,491 Reputation points
    2022-11-22T01:41:15.823+00:00

    Hi @reddy421

    You may try to use script task to do that.

    Define the file name with expression as below

    "DD_Adjustment_HOLY_"+SUBSTRING((DT_WSTR, 30)getdate(),1,4)+"-"+SUBSTRING((DT_WSTR, 30)getdate(), 6,2)+"-"+SUBSTRING((DT_WSTR, 30)getdate(), 9,2)  
    

    Reference here: https://stackoverflow.com/questions/66242015/download-sftp-file-using-ssis-package

    Regards,

    Zoe Hui


    If the answer is helpful, please click "Accept Answer" and upvote it.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.