Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How to Zip folder/file using Winzip32.exe in C#

How to Zip folder/file using Winzip32.exe in C#

Scheduled Pinned Locked Moved C#
csharptutorialquestion
10 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nilam2477
    wrote on last edited by
    #1

    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

    C L 2 Replies Last reply
    0
    • N nilam2477

      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

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      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 )

      D 2 Replies Last reply
      0
      • C Christian Graus

        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 )

        D Offline
        D Offline
        dan sh
        wrote on last edited by
        #3

        Zip Classes in the J# Class Libraries to Compress Files and Data with C#[^]

        Until you realize this message has nothing to say, its too late to stop reading

        1 Reply Last reply
        0
        • C Christian Graus

          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 )

          D Offline
          D Offline
          dan sh
          wrote on last edited by
          #4

          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

          C P 2 Replies Last reply
          0
          • D dan sh

            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

            C Offline
            C Offline
            Christian Graus
            wrote on last edited by
            #5

            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 )

            1 Reply Last reply
            0
            • N nilam2477

              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

              L Offline
              L Offline
              logiclabz
              wrote on last edited by
              #6

              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

              N 1 Reply Last reply
              0
              • L logiclabz

                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

                N Offline
                N Offline
                nilam2477
                wrote on last edited by
                #7

                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

                C 1 Reply Last reply
                0
                • N nilam2477

                  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

                  C Offline
                  C Offline
                  Christian Graus
                  wrote on last edited by
                  #8

                  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 )

                  N 1 Reply Last reply
                  0
                  • D dan sh

                    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

                    P Offline
                    P Offline
                    Pete OHanlon
                    wrote on last edited by
                    #9

                    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.

                    My blog | My articles

                    1 Reply Last reply
                    0
                    • C Christian Graus

                      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 )

                      N Offline
                      N Offline
                      nilam2477
                      wrote on last edited by
                      #10

                      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

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups