Here is the Code we were using to merge multiple csv files with same format in to one Csv file
How can I make use of this code in ssis or how can I rewrite it to perform the same function.
Thanks for the help in advance.
Dim sFilename As String
Dim PathName As String
Dim PathFinal As String
Dim objFSO As Object
Dim objOutputFile As String
sFilename = "FinalFileName"
PathName= "Path of the file to merge"
PathFinal = "DestinationPath of FinalFileName"
Const ForReading = 1
objFSO = CreateObject("Scripting.FileSystemObject")
objOutputFile = objFSO.CreateTextFile(PathFinal & "\" & sFilename & ".CSV")
strComputer = "."
objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
FileList = objWMIService.ExecQuery _
("ASSOCIATORS OF {Win32_Directory.Name='" & PathName & "'} Where " _
& "ResultClass = CIM_DataFile")
For Each objFile In FileList
objTextFile = objFSO.OpenTextFile(objFile.Name, ForReading)
strText = objTextFile.ReadAll '(The beginning of this line is the line specified by the error)
objTextFile.Close()
objOutputFile.WriteLine(strText)
Next
objOutputFile.Close()
How can I make use of this code in ssis or how can I rewrite it to perform the same function.
Thanks for the help in advance.
Dim sFilename As String
Dim PathName As String
Dim PathFinal As String
Dim objFSO As Object
Dim objOutputFile As String
sFilename = "FinalFileName"
PathName= "Path of the file to merge"
PathFinal = "DestinationPath of FinalFileName"
Const ForReading = 1
objFSO = CreateObject("Scripting.FileSystemObject")
objOutputFile = objFSO.CreateTextFile(PathFinal & "\" & sFilename & ".CSV")
strComputer = "."
objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
FileList = objWMIService.ExecQuery _
("ASSOCIATORS OF {Win32_Directory.Name='" & PathName & "'} Where " _
& "ResultClass = CIM_DataFile")
For Each objFile In FileList
objTextFile = objFSO.OpenTextFile(objFile.Name, ForReading)
strText = objTextFile.ReadAll '(The beginning of this line is the line specified by the error)
objTextFile.Close()
objOutputFile.WriteLine(strText)
Next
objOutputFile.Close()