Link to home
Start Free TrialLog in
Avatar of ktbsandeep
ktbsandeepFlag for United States of America

asked on

I need to unzip all files in a folder using SSIS.

I need to unzip all files in a folder using SSIS. Right now I am able to unzip individual files by hardcoding their names. I want all to be done at once.
Avatar of JR2003
JR2003

You could call a program like 7-zip (7za.exe needs no installation) from the a script control in SSIS.
Avatar of ktbsandeep

ASKER

When I am trying to use a execute process task and providing the winzip32.exe in executables. I am facing problems in sending all zip file names as argument to that. Please let me know how to send the file names as an argument in execute process task.
If you use 7-zip you can execute it in a shell from a VB.NET script control
Thanks. Can you please send me 1 example on how to use 7-zip and execute it in a shell from a VB.NET script control.
I;ve edited some old vbScript I have but a function to zip a file should look something like this:

Private Sub ZipFile(ByVal sFromPath As String, ByVal sToPath As String, ByVal sFromFileName As String, ByVal sToFileName As String)

        Dim s7za As String = "C:\Program Files\7-Zip\7za.exe"
        Dim sArguments As String
        Dim myProcess As New System.Diagnostics.Process

        Dim sFullFromFileName As String
        Dim sFullZipFileName As String

        sFullFromFileName = sFromPath & sFromFileName
        sFullZipFileName = sToPath & sToFileName

        sArguments = " a -tzip -mx1 -y  """ & sFullZipFileName & """ """ & sFullFromFileName & """"
        myProcess.Start(s7za, sArguments)

    End Sub
This script is agin to zip a single file. I am in need of unzipping all files in a folder.
You could call it once for each file in the folder and it will add each file to the zip
How can I do that using the "Execute Process Task" in SSIS. Can you please explain me that?
You can do it from a script control. You can just write .NET code in a scriipt control so can erxecute things using System.Diagnostics.Process.
ASKER CERTIFIED SOLUTION
Avatar of ktbsandeep
ktbsandeep
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial