Anyone here use SSIS?

AsSiMiLaTeD
AsSiMiLaTeD Posts: 11,726
edited April 2011 in The Clubhouse
I have what should be a simple need and am having the hardest time figuring it out. I have a folder that contains multiple zip files and I need SSIS to loop through and unzip all of those files.

I use Foreach loops all the time to do processing so I know that part of the problem, but I'm having the hardest time getting the unzip process to work.
Post edited by AsSiMiLaTeD on

Comments

  • On3s&Z3r0s
    On3s&Z3r0s Posts: 1,013
    edited April 2011
    Does SSIS have a built-in zip library? Or are you calling out to something to do the unzip? Is there any reason it needs to be done in SSIS as opposed to PowerShell for instance?
  • AsSiMiLaTeD
    AsSiMiLaTeD Posts: 11,726
    edited April 2011
    SSIS does NOT have a built in zip library as far as I know. I've found a custom script written in C# that requires a separate library, but can't get it to work.

    It's part of a very large job that sits in a running state, and really needs to be done in SSIS.
  • AsSiMiLaTeD
    AsSiMiLaTeD Posts: 11,726
    edited April 2011
    I found a way to execute a command line and use something like pkzip, but can't figure out how to use a variable as a parameter there, if I could just get that I'd be all set.
  • On3s&Z3r0s
    On3s&Z3r0s Posts: 1,013
    edited April 2011
    That is a tough one. I was guessing there wasn't a native facility in SSIS for that since MSFT has never built convenient de/compression into any product. I've used SharpZipLib before, but it would require writing some custom code, probably as a little shell console app in C# or VB.NET. Then you could call that from SSIS. Unfortunately it would take a little time and wouldn't be something you could bang out in 15 minutes.

    Found this though, which might help if you can put the looping together with it:
    http://www.rafael-salas.com/2008/10/ssis-compress-files-using-execute.html

    As far as using variables as a command line argument, can you use @variableName in place of the argument and let SSIS perform the substitution?
  • On3s&Z3r0s
    On3s&Z3r0s Posts: 1,013
    edited April 2011
    Man, debugging SSIS sucks hard! I come to Club Polk to get away from this stuff, now this place is ruined for me. :mad::wink:

    Seriously, I think I figured out how to do the variable binding. When you open the Foreach Loop Editor's Collection settings you'll set up the Enumerator configuration on the target folder and select the correct radio button to get the form of the file name you want. I'd imagine you made it that far already. Then in the Variable Mappings settings you need to create a new variable. This variable will contain the file name returned by the enumerator (that you'll be unzipping). That should be it for the Foreach container.

    Then you'll have the Execute Process Task within the Foreach. In the editor dialog for that, you go to Expressions and add a new expression for the Arguments property that uses the variable you mapped in Foreach (like @[User::fileName] for example. You can combine this with other hardcoded arguments, just remember to leave a space between them and escape backslashes or quotes if you need those in the literals. I made a little proof of concept with xcopy.exe and it worked, so I'd imagine you could do the same thing to iteratively call pkzip. In the thumbnails you can see that xcopy will get called with c:\source as the working directory, then the first argument passed to it will be the filename from the foreach and the second argument will be the name of the target directory. It's not exactly the same as your situation obviously, but illustrates variable mapping for parameters/arguments.

    Good luck!
  • AsSiMiLaTeD
    AsSiMiLaTeD Posts: 11,726
    edited April 2011
    I got it figured out using 7-zip. basically what you described is what I was trying to do, but its picky about how you call a variable, and every zip program is different.

    I did get it working though, and yes I agree debugging SSIS sucks...
  • On3s&Z3r0s
    On3s&Z3r0s Posts: 1,013
    edited April 2011
    Cool, congrats!
  • nguyendot
    nguyendot Posts: 3,594
    edited April 2011
    ugh sql.
    Main Surround -
    Epson 8350 Projector/ Elite Screens 120" / Pioneer Elite SC-35 / Sunfire Signature / Focal Chorus 716s / Focal Chorus CC / Polk MC80 / Polk PSW150 sub

    Bedroom - Sharp Aquos 70" 650 / Pioneer SC-1222k / Polk RT-55 / Polk CS-250

    Den - Rotel RSP-1068 / Threshold CAS-2 / Boston VR-M60 / BDP-05FD
  • Sherardp
    Sherardp Posts: 8,038
    edited April 2011
    I would recommend 7-zip for this. Should be able to do what your looking for.
    Shoot the jumper.....................BALLIN.............!!!!!

    Home Theater Pics in the Showcase :cool:

    http://www.polkaudio.com/forums/showcase/view.php?userid=73580
  • johnbobi21
    johnbobi21 Posts: 1
    edited April 2011
    I can help you short sale your property and never pay the bank another penny. Contact us for a free consultation.
    When we talk, I will explain how the process works in detail and answer any questions you may have. Or, if you prefer, you can call me at (303) 495-3350
    Thanks for reading this, Taylor Grant.
    Taylor Grant is a Real Estate Agent at Colorado Custom Realty, LLC. Fort Collins Short Sales Realtor:
    www.ColoradoHomeRescue.org
    Phone: (303) 495-3350.
  • rooftop59
    rooftop59 Posts: 8,121
    edited April 2011
    reported #11
    Living Room 2.2: Usher BE-718 "tiny dancers"; Dual DIY Dayton audio RSS210HF-4 Subs with Dayton SPA-250 amps; Arcam SA30; Musical Fidelity A308; Sony UBP-x1000es
    Game Room 5.1.4:
    Denon AVR-X4200w; Sony UBP-x700; Definitive Technology Power Monitor 900 mains, CLR-3000 center, StudioMonitor 350 surrounds, ProMonitor 800 atmos x4; Sub - Monoprice Monolith 15in THX Ultra

    Bedroom 2.1
    Harmon Kardon HK3490; Bluesounds Node N130; Polk RT25i; ACI Titan Subwoofer