I need to my SSIS package to create a dynamic text file on the local file system that will be referenced by a subsequent Execute Process task. Specifically I want my Execute Process task to run the WinSCP process to use a script file (stored as a plain text file) to upload a zip file to an sftp server. The problem is that the name of the zip file changes every day according to the current date so I need the WinSCP script file to change its contents every day to make sure the correct zip file is uploaded to the sftp server.
My WinSCP script file will contain something like this:
option batch on
option confirm off
-hostkey="ssh-rsa 1024 68:87:fa:79:2f:70:2c:28:f0
It is the put statement that needs to be dynamic.
If we say that the WinSCP script file is "D:\SSIS\WinSCP\Scripts\My
pt.txt" can someone please give me detailed instructions on how to write a script task that will delete and recreate "D:\SSIS\WinSCP\Scripts\My
pt.txt" every day, using a pre-set package level variable (lets call it MyReportFileName) to construct the put statement? I think the return characters to terminate each line are important too.
I know how to delete the file if it exists using the following (VB) code:
But when it comes to writing lines to a new text file, I'm not sure what to do. Your help will be much appreciated!
Thanks in advance.