How to Zip folder/file using Winzip32.exe in C#
-
i need to zip the files/folder. How can i use winzip32.exe in C# code to programatically zip the files or folder. If you could provide some sample code that would be great. Thanks
Process.Start will start winzip, so I guess if you can provide the files on the command line, that will do it for you. I thought zip support was built in now, I know for sure there are third party libraries you can use. WinZip is a commercial product, you need for your users to buy it if you use it for zipping.
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
Process.Start will start winzip, so I guess if you can provide the files on the command line, that will do it for you. I thought zip support was built in now, I know for sure there are third party libraries you can use. WinZip is a commercial product, you need for your users to buy it if you use it for zipping.
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
Process.Start will start winzip, so I guess if you can provide the files on the command line, that will do it for you. I thought zip support was built in now, I know for sure there are third party libraries you can use. WinZip is a commercial product, you need for your users to buy it if you use it for zipping.
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
I found the class System.IO.Compression.GZipStream which might serve the purpose. I have never used it though. Have you come across this class??
Until you realize this message has nothing to say, its too late to stop reading
I've not used it, but I had a feeling that such a class was in the newer versions of C#.
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
i need to zip the files/folder. How can i use winzip32.exe in C# code to programatically zip the files or folder. If you could provide some sample code that would be great. Thanks
-
As said by other's you can use System.IO.Compression class in .Net 2.0 Sample : Compress / Gzip files in .Net 2.0 using C# ---------- Logiclabz
modified on Thursday, March 26, 2009 3:14 AM
My requirement is to zip the files if i use System.IO.Compression class the files are compressed. again for decompression i have to write a program. I want to use WinZip utility only. I used the Process.Start as shown below System.Diagnostics.Process.Start("C:\\Program Files\\WinZip\\winzip32.exe -min -a D:zippy.zip D:\\1.txt"); but i get an error at run time "The system cannot find the file specified" If i specify only the exe name System.Diagnostics.Process.Start("C:\\Program Files\\WinZip\\winzip32.exe"); then winzip exe is opened. How do i specify the parameters. Please help
-
My requirement is to zip the files if i use System.IO.Compression class the files are compressed. again for decompression i have to write a program. I want to use WinZip utility only. I used the Process.Start as shown below System.Diagnostics.Process.Start("C:\\Program Files\\WinZip\\winzip32.exe -min -a D:zippy.zip D:\\1.txt"); but i get an error at run time "The system cannot find the file specified" If i specify only the exe name System.Diagnostics.Process.Start("C:\\Program Files\\WinZip\\winzip32.exe"); then winzip exe is opened. How do i specify the parameters. Please help
I thought the compression classes used the same algorithm as winzip ?
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
I found the class System.IO.Compression.GZipStream which might serve the purpose. I have never used it though. Have you come across this class??
Until you realize this message has nothing to say, its too late to stop reading
It was introduced in .NET 2, and people who've used it have noticed some issues with it.
Deja View - the feeling that you've seen this post before.
-
I thought the compression classes used the same algorithm as winzip ?
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
I tried to compress file using GZipStream but when i used WinZip32.exe to unzip the files it dint work. It gave an error message "Cannot open file. it does not appear to be a valid archive" Does this mean that compressing class GZipStream does not use the same algorithm as Winzip? If that is the case then i cannot use GZipStream to zip the files. Please let me know if you have any other suggestions. Thanks