CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 11 of 11
  1. #1
    Join Date
    Sep 2007
    Posts
    65

    Angry How to Zip a Folder

    Hi ALL,

    How to zip a folder through code in vb 6.0 ... the folder must be zipped along with the files/contents and sub folder inside it....


    Thanks in Advance
    FAYAZ.

  2. #2
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,538

    Re: How to Zip a Folder

    Quote Originally Posted by FayazNizami View Post
    Hi ALL,

    How to zip a folder through code in vb 6.0 ... the folder must be zipped along with the files/contents and sub folder inside it....


    Thanks in Advance
    FAYAZ.
    As much as I remember there was a control regarding that in the web anywhere. But as much as I remember too, it wasn't working properly it has lots of bugs. Use vb.net for programs that needs something like that.
    But see also here, maybe he has found a solution to use that dll
    http://www.codeguru.com/vb/gen/vb_gr...icle.php/c6743
    Last edited by JonnyPoet; April 6th, 2010 at 02:22 PM.
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

  3. #3
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: How to Zip a Folder

    the ZIP format was developed by WinZip many years ago, and they patented it. Others have copied it and changed it. Windows even has a method built-in, called COMPACT, which compresses files, and if you RIGHT-CLICK, there's a SEND-TO option that uses ZIP format


    C:\>COMPACT /?
    Displays or alters the compression of files on NTFS partitions.

    COMPACT [/C | /U] [/S[ir]] [/A] [/I] [/F] [/Q] [filename [...]]

    /C Compresses the specified files. Directories will be marked
    so that files added afterward will be compressed.
    /U Uncompresses the specified files. Directories will be marked
    so that files added afterward will not be compressed.
    /S Performs the specified operation on files in the given
    directory and all subdirectories. Default "dir" is the
    current directory.
    /A Displays files with the hidden or system attributes. These
    files are omitted by default.
    /I Continues performing the specified operation even after errors
    have occurred. By default, COMPACT stops when an error is
    encountered.
    /F Forces the compress operation on all specified files, even
    those which are already compressed. Already-compressed files
    are skipped by default.
    /Q Reports only the most essential information.
    filename Specifies a pattern, file, or directory.

    Used without parameters, COMPACT displays the compression state of
    the current directory and any files it contains. You may use multiple
    filenames and wildcards. You must put spaces between multiple
    parameters.
    Last edited by dglienna; April 6th, 2010 at 02:36 PM.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  4. #4
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: How to Zip a Folder

    Quote Originally Posted by dglienna View Post
    the ZIP format was developed by WinZip many years ago, and they patented it.
    Actually I think it was PKWare I was using PKZip and PKUnzip long before I ever saw winzip.

  5. #5
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: How to Zip a Folder

    WinZip 1.0 was released in April 1991 as a shareware Windows GUI front-end for PKZIP. Earlier in January 1991 Nico Mak Computing released GUI front-end for OS/2 Presentation Manager called PMZIP. It used OS/2 versions of the PKWARE, Inc. PKZIP and PKUNZIP programs.

    Starting from v5.0 in 1993 the creators of WinZip incorporated compression code from the Info-ZIP project, thus eliminating the need for the PKZIP executable to be present.

    http://en.wikipedia.org/wiki/Winzip

  6. #6
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: How to Zip a Folder

    Well, I was using ARJ back then. It did what I needed, and the admin's had know idea that it could do such great compression, given enough time on a slow box...
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  7. #7
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: How to Zip a Folder

    Yep. I used ARJ quite a lot also

  8. #8
    Join Date
    Apr 2009
    Posts
    394

    Re: How to Zip a Folder

    To answer the OP original Q, you can do any of the following. Go to infozip's web site and download for free the C code and create your own dll's or I believe they have them already compiled for you (don't remember???). Don't forget to read the license agreement at http://www.info-zip.org/

    2. http://www.vbaccelerator.com/home/index.asp has under its vb6 section three projects for adding zip functionality. One for zipping, unzipping, and zipping vb6 projects. They have the infozip dll's compiled and ready for download and the dlls have been renamed.

    3. And I'm surprised none of you have pointed the OP to this article!!! Because it is here on this website!!! http://www.codeguru.com/vb/gen/vb_gr...cle.php/c6743/ which uses the infozip's dlls

    Edit: I see JohnnyPoet did link that 3rd option article...



    Good Luck

  9. #9
    Join Date
    May 2005
    Location
    Sterling Heights, MI
    Posts
    74

    Re: How to Zip a Folder

    Quote Originally Posted by vb5prgrmr View Post
    3. And I'm surprised none of you have pointed the OP to this article!!! Because it is here on this website!!! http://www.codeguru.com/vb/gen/vb_gr...cle.php/c6743/ which uses the infozip's dlls
    That is the link I always give out.

  10. #10
    Join Date
    Apr 2009
    Posts
    394

    Re: How to Zip a Folder

    Quote Originally Posted by vb5prgrmr View Post
    Edit: I see JohnnyPoet did link that 3rd option article...
    But HACK! You previously did not reply to this thread...

  11. #11
    Join Date
    Aug 2003
    Location
    Sydney, Australia
    Posts
    1,900

    Re: How to Zip a Folder

    I have used CGZipLIbrary successfully for years - should find it by searching this forum or Google

    I think its the same as http://www.codeguru.com/vb/gen/vb_gr...cle.php/c6743/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured