M. Mehta M. Mehta - 7 months ago 56
Vb.net Question

SSIS Script Task search Text if available copy file

I am at very basic level on SSIS and need help to build script for script task.

I have LOG file generated by SSIS package, I have to search for word "MSG" in LOG file, if it's available I have to copy file to another location otherwise leave it.

I have to use For-each Loop container + Script task + File System Task. I also created 3 variables

Log_File_Path - String - D:\Test\

Log_File_Name - String - xyz.log

MSG_Exists - INT32 - 0

Now I have to write script to search for "MSG".

Anybody can help me for that.

Thanks in advance.


You can use a c# script. Here is some psuedo code.

using dts.variables get path and file name use this command to read entire file into string

string contents = File.ReadAllText(@"C:\temp\test.txt");

if (contents.contains("MSG")
   set dts variable MSG_Exists

Is this what you are looking to do?