none
Zipping/Unzipping Files RRS feed

  • General discussion

  • All,

    If you have a need to zip/unzip files – with progress reporting – you might want to give my newest assembly a try.

    It’s based on DotNetZip which I’ve used for several years now. I also use a not-free third party assembly that works well, but for the price of DotNetZip – free – it offers a lot.

    It can do much more than what I’m using here; this is specifically for zipping and unzipping one or more files to/from a zip archive.

    I have this set up so that you can optionally encrypt the entries in the zip file using AES encryption and, additionally, it’s set up to use the Zip64 specification so that resultant zip file size and number of/size of the entries is virtually unlimited.

    Of course there’s a limit, but it’s well beyond what most of us will ever need. From this article:

    For reference purposes, with the Zip64 extension to the Zip file format enhancement, Zip files of 16 exabytes, which is over 16 billion gigabytes (or 2 to the 64th power bytes) are possible. Likewise, over 4 billion files and folders can be included in a Zip file.

     

    *****

     

    There are two main classes that you’ll work with:

    CompressToZip and DecompressFromZip:

    Unlike the ZipFile class that’s built into the BCL, mine is meant specifically to work with file paths. If you want the functionality of something like the .CreateFromDirectory method of the built-in one, then I’m leaving that up to you.

     

    *****

     

    I have my ‘test project’ folder zipped up and uploaded here for you. The assembly is called ‘CAEP’ and you’ll see it in the root directory when you extract that zip file:

    The user interface is pretty straightforward as shown below. I have a tab control set up with two tab pages; one for zipping and the other for unzipping:

    Also, please be sure to look at the options:

    These options are NOT persisted to file, so each time you open the program you’ll need to set them again.

    I’ll zip up a fairly good-sized bunch of .wmv files in the following example:

    I didn’t use the “password” functionality there but I’ve tested it and it works. Even though I’m referring to it as a password, that’s not really correct. It’s 256-bit AES encryption and shouldn’t be confused with the older PKZip password-protected zip file.

    Unzipping is equally easy:

    As always, if you find something that’s not working right or if you have suggestions on improvements/enhancements then please let me know.

    I hope that some of you will find this helpful. :)


    "One who has no vices also has no virtues..."





    • Edited by Frank L. Smith Wednesday, January 10, 2018 2:31 PM ...updated image URL's
    Sunday, March 5, 2017 3:31 PM

All replies

  • Is there a new link to the code, please? The 'https://fls.exavault.com/share/view/gcys-9ecjie75' link is disabled now.
    Monday, January 1, 2018 1:02 PM
  • Is there a new link to the code, please? The 'https://fls.exavault.com/share/view/gcys-9ecjie75' link is disabled now.

    Tim,

    I'm pretty sure this is it:

    https://fls.exavault.com/share/view/22fn-dqc1tgs5

    If that proves to not be the one then let me know and I'll dig into it more.


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Monday, January 1, 2018 1:49 PM
  • Thanks for replying, Frank, but that look like the wrong link - its something called 'Test_UploadViaFTP'.
    Monday, January 1, 2018 2:15 PM
  • Thanks for replying, Frank, but that look like the wrong link - its something called 'Test_UploadViaFTP'.

    This thread it about zipping/unzipping - it has nothing to do with FTP.

    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Monday, January 1, 2018 2:23 PM
  • Thanks for replying, Frank, but that look like the wrong link - its something called 'Test_UploadViaFTP'.

    You've got a good memory!

    I found it:

    http://www.fls-online.net/VBNet_Forum/01-01-18/Test_UploadViaFTP.zip


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Monday, January 1, 2018 3:12 PM
  • No, you have not understood me correctly. Both those links point to the same zipfile containing a 'Test_UploadViaFTP' folder, but the image above 'http://www.fls-online.net/VBNet_Forum/03-05-17/ScreenShot10.png' shows a folder called 'Demo_ZipWithProgress' and a file 'CAEP.dll'. It is the 'Demo_ZipWithProgress' solution that I would like to share, to try out your code.
    Monday, January 1, 2018 3:49 PM
  • No, you have not understood me correctly. Both those links point to the same zipfile containing a 'Test_UploadViaFTP' folder, but the image above 'http://www.fls-online.net/VBNet_Forum/03-05-17/ScreenShot10.png' shows a folder called 'Demo_ZipWithProgress' and a file 'CAEP.dll'. It is the 'Demo_ZipWithProgress' solution that I would like to share, to try out your code.

    Oh - you're right that I didn't understand.

    I'll hunt for it and report back.


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Monday, January 1, 2018 3:52 PM
  • No, you have not understood me correctly. Both those links point to the same zipfile containing a 'Test_UploadViaFTP' folder, but the image above 'http://www.fls-online.net/VBNet_Forum/03-05-17/ScreenShot10.png' shows a folder called 'Demo_ZipWithProgress' and a file 'CAEP.dll'. It is the 'Demo_ZipWithProgress' solution that I would like to share, to try out your code.

    Apparently I modified it after the fact.

    This one appears to be the one you want and it does contain the CAEP.dll file:

    https://fls.exavault.com/share/view/22fp-49blj200

    Let me know please?


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Monday, January 1, 2018 3:57 PM
  • Yes, that's the correct one. Thanks a lot, and HNY. Why MS produced their ZipFile class without anyway to tell if it has completed is beyond me, so thanks for doing it yourself.
    Monday, January 1, 2018 4:30 PM
  • Yes, that's the correct one. Thanks a lot, and HNY. Why MS produced their ZipFile class without anyway to tell if it has completed is beyond me, so thanks for doing it yourself.

    I'm glad it helped. This one uses DotNetZip and it's worth experimenting with.

    Getting the events to work out was a chore, but it's done. :)


    "A problem well stated is a problem half solved.” - Charles F. Kettering


    • Edited by Frank L. Smith Monday, January 1, 2018 4:39 PM ...added link
    Monday, January 1, 2018 4:38 PM