Can you help me to Zip the files?
Hi friends,I have two cubes in a folder.I just want to Zip those two cubes using SSIS automatically.The requirement seems very simple.But I am not aware of how to start .Your help would be very much appreciated guys!!Thanks in advance...
July 30th, 2009 10:08pm

You can use an execute process task in control flow to run an utility command line to compress the files. I have an example here, but you can use any utility that has command line support:http://rafael-salas.blogspot.com/2008/10/ssis-compress-files-using-execute.htmlRafael Salas | Dont forget to mark the post(s) that answered your question http://rafael-salas.blogspot.com/
Free Windows Admin Tool Kit Click here and download it now
July 30th, 2009 10:20pm

Or you can look at some Tasks available from third parties. This one's free:TaskUnZip - Manages compressed files (including password protected).And there are two commercial components, one from CozyRoc and one from /n Software. Check the SSIS Community Tasks and Components page for more info.
July 30th, 2009 10:27pm

Thanks buddy!!!!!Now I have threeq uestions.1.Instead of 7z, I tried to use Winzip,but it is not working.Could you kindly tell me why?2.As mentioned in your post, I tried with txt file and it worked.If I want to zip the CUBE, the process is same,right?3.After Zippingis done, that zippedfile should be stored in the previous month's folder. That means, suppose if I create a package that zips the cube for July month,after zipping, that zipped file should be stored in June moth folder. Can you throw some light for this also?...Thanks in advance Rafael!!!!
Free Windows Admin Tool Kit Click here and download it now
July 30th, 2009 11:33pm

Thanks Todd!!!This CP TaskUnZip task is for Unzipping,right?.My requirement is to ZIP the file.Anyways, thanks for your reply buddy!!!
July 30th, 2009 11:35pm

Nope - it will do both. It uses SharpZipLib.
Free Windows Admin Tool Kit Click here and download it now
July 30th, 2009 11:50pm

Great!!! Can you explain me a bit more about how to install it and how to integrate ShareZipLib?..Thanks in advance!!!!
July 31st, 2009 12:01am

Just click through the link I gave above. On that page, there's a link to the project's main page, where the author has very complete instructions on how to install it. Keep in mind that you'll need to install it on any computer you're going to execute your package on. The component is completely self-contained for zipping - you don't have to do any coding to use SharpZipLib - the author did all that for you. After you install the component, you'll need to add it to your toolbox (also explained on his main page). From there, you just drag and drop and use it like any other SSIS Control Flow Task.
Free Windows Admin Tool Kit Click here and download it now
July 31st, 2009 12:13am

Thanks again Todd for your prompt and quick reply!!!!!!!!!One final query, Suppose I execute the Zip task on July 1st, after zipping is done,the zipped file should be stored in the folder called JUNE. Will that be possible If in that ? if so,just give very small overview about it...Waiting for your reply Todd :-)
July 31st, 2009 12:27am

Sure. I'm not sure what facility the Task itself has for specifying a file name, as I haven't used it. However, I'd expect that:In using the Task, you'd have to specify:1. Whether you want to Zip or Unzip. (You'd choose to Zip.)2. Some kind of filespec (a folder, maybe wildcards are allowed) indicating what files to include in the Zip.3. A filename for the Zip archive itself.Of course, those would be fields you would "type in" - just like any other Task. However, just like any Task, those properties are "expressionable". That means you can supply a dynamic value to a property at runtime. In your case, that property would be the file name of the Zip, and it would dynamically vary based on the date.The first thing you would do is select the Task on the Control Flow, then go to the Properties window (press F4). In the Properties window, there's a property called "Expressions". Select that, and you'll see an ellipsis button (...) on the right. Press it. A new window will open with a property grid in it. Pull down the "property" list, and find the property that looks like it's where the author wants the Zip file name to go - it should be obvious. There should now be another ellipsis button to the right in that window. Press it, and you'll open the Expression Editor. You can now enter an expression you'd like assigned to that Task. Perhaps something like this (backslash is the escape character in expression strings, so you have to double it to actually use it):"C:\\Temp\\June\\MyArchive.Zip"That's not terribly dynamic, but press the "evaluate" button, and you'll see that it's an acceptable expression. Try this:"C:\\Temp\\" + (DT_WSTR, 2)MONTH(GETDATE()) + "\\MyArchive.Zip"You'll see that this places the month number into the string. Unfortunately, the SSIS date functions won't return you a month name - they don't havea functionfor that. The best you can do is use conditional statements to build one:"C:\\Temp\\" + (MONTH(GETDATE()) == 1? "January" : MONTH(GETDATE()) == 2 ? "February" : "and so on") + "\\MyArchive.Zip"
Free Windows Admin Tool Kit Click here and download it now
July 31st, 2009 12:47am

Thanks dude!!!Will check it out and come back to you tomorow incase of any challenges..thanks again man!!
July 31st, 2009 1:11am

Hi friends, I have two cubes in a folder.I just want to Zip those two cubes using SSIS automatically.The requirement seems very simple.But I am not aware of how to start . Your help would be very much appreciated guys!! Thanks in advance... I have got a big experience of working with zip files. But some days ago I ran against an unpleasant complication, which was easily resolved one tool. Which on my opinion might help for you too - fix zip .
Free Windows Admin Tool Kit Click here and download it now
December 3rd, 2010 11:15am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics