How to Zip the files in a folder using SSIS package
I need to create a package to zip all the files in the folder and have to FTP the Zip file to vendor. Please help me how can I do this in SSIS?
January 17th, 2012 2:15pm
If you do not want to pay for third party tools then download a freeware compression utility e.g. GZIP. GZIP is WinZip and Windows built in compression fully compatible, I use it if other compression utilities are not available. Then craft up a bat file in which you would set to zip (compress) the files in question (you will need to learn the command line switches). In the package drag and drop the Execute Process Task and set to run the bat file, and finally add the FTP task in which you configure to FTP the archive you generate.Arthur My Blog
January 17th, 2012 4:00pm
there is actually native compression in SSIS (via .NET) I have posted this previously Imports System.IO Imports System.IO.Compression sub Main() compress("Full_File_Path_And_Name_And_Extension") end sub Public Sub Compress(ByVal FilePath As String ) Dim UncompressedData As Byte () = System.IO.File.ReadAllBytes(FilePath) Dim CompressedData As New MemoryStream() Dim GZipper As New GZipStream(CompressedData, CompressionMode.Compress, True ) GZipper.Write(UncompressedData, 0, UncompressedData.Length) GZipper.Dispose() System.IO.File.WriteAllBytes(Left(FilePath, InStr(FilePath, ".") - 1) + ".gz" , CompressedData.ToArray) CompressedData.Dispose() End Sub This uses native compression in .NET which means that you do not need to install anything on the server - the only downside is that clients need to have 7-zip (or similar) installed to be able to unzip the filesRgds Geoff
January 17th, 2012 5:57pm
For the FTP part for the solution follow this link http://www.sqlservergeeks.com/blogs/raunak.jhawar/sql-server-bi/398/sql-server-2012-ssis-sending-files-using-ftp-taskPlease vote as helpful or mark as answer, if it helps Cheers, Raunak | t: @raunakjhawar
January 17th, 2012 11:36pm
You can also get these tasks premade into drag and drop tools: SSIS Community Tasks and Components. Talk to me now on
January 19th, 2012 12:40pm
Hi, You can use any of the below to Zip file Script Task Component Execute Process Task Custom Task Component Using Script task, you need to write VB/Net code to compress file(in built libraries) as given above by Geoff. Using Execute process task, you can compress by executing commands( WinZip or Windows compression utility). Aslo there are Custom task available on net, download the .dll and register the same in GAC, you can use the same in your BIDS. Thanks, Adil
January 20th, 2012 1:15am
One more Script Task example: http://microsoft-ssis.blogspot.com/2011/01/zip-sourcefile-to-archive.html It uses the Visual J# Redistributable Packages to zip. Please mark the post as answered if it answers your question | My SSIS Blog: http://microsoft-ssis.blogspot.com
January 20th, 2012 2:53am
you can zip files using Execute Process Task. I have attached a figure, in which am zipping all the files in folder(D:\Folder). let me know if you have any queries further.
January 20th, 2012 7:27am
I found a nice visual tool here: http://www.cozyroc.com/ssis/zip-task MVP MCT MCTS Daniel Calbimonte http://elpaladintecnologico.blogspot.com
January 20th, 2012 11:36am
Hi Guest389, Please refer to the following article details about how to ZIp files using SSIS: http://www.sqlservercentral.com/articles/Integration+Services+(SSIS)/64028/ Thanks, Eileen
January 24th, 2012 1:07am
hi is there any way to zip the perticuler file from the given folder. Regards Mahesh
January 25th, 2012 2:36am
Hi All, I reviewed above examples for zipping in SSIS using differetn ways. So it looks like we have to use 3rd party lib/tools to implement the zipping functionality. Will it be possible by any means of doing this by not using WINZIP/RAR/7ZIP/VSJLIB...? i am just trying not to use any 3rd party software on our production box just for this zpping functionality!. Any help will be appreciated... Thanks a lot. vsr
February 1st, 2012 12:18pm
To Mahesh, if you are using Executable process task, then u can provide u r file details in one of the paramter under Arguments property. -min -a "C:\xyz\Desktop\project\zipfilename.zip" "C:\xyz\myfilename.csv" hope it helps.
February 1st, 2012 12:22pm
You can code a Script Task using .Net compression library as described here: http://msdn.microsoft.com/en-us/library/ms404280%28v=vs.85%29.aspxArthur My Blog
February 1st, 2012 12:24pm
As I mentioned in my example, the code I provided is native to .NET and SSIS - no 3rd party libraries needed on the box The only thing that is needed is that the client needs to download 7-ZIP which is shareware (free) - doesn;t need to be loaded onto your prod box, just on any client that may need to unzip the files (the files can also be unzipped using .net code)Rgds Geoff ----------------------------------------------------------- Mark as Answer if this resolves your problem or "Vote as Helpful" if you find it helpful.
February 1st, 2012 5:22pm
check this tutorial http://www.sqlservercentral.com/articles/SSIS/64028/
February 2nd, 2012 4:11am