SharpZipLib I'm getting an empty folder as a result when compressing a folder using the SharpZipLib library

Posted on 2007-10-17
Last Modified: 2012-08-14
I pretty much uses the code provided in the example to create a zip file, but the output file is empty and has no content. I'm using .NET 1.1, Windows XP SP2  and Visual Studio 2003.
I have also compiled the sample project that came with the library and again the output zip file is empty.

Has anyone run into this problem and knows what to do to fix it


Dim dir As String
    dir = "E:\wwwroot\test"
    Dim astrFileNames() As String = Directory.GetFiles(dir)
    Dim targetName As String = "E:\wwwroot\backup\"
    Dim s As Zip.ZipOutputStream
    Dim objZipEntry As Zip.ZipEntry

      s = New Zip.ZipOutputStream(File.Create(targetName))
      REM Compression Level: 0-9
      REM 0: no(Compression)
      REM 9: maximum compression
      Dim strFile As String
      For Each strFile In astrFileNames
        Dim strmFile As FileStream = File.OpenRead(strFile)
        Dim abyBuffer(strmFile.Length - 1) As Byte
        strmFile.Read(abyBuffer, 0, abyBuffer.Length)
        objZipEntry = New Zip.ZipEntry(strFile)
        objZipEntry.DateTime = DateTime.Now
        objZipEntry.Size = strmFile.Length
        s.Write(abyBuffer, 0, abyBuffer.Length)
Question by:roddios
    LVL 96

    Expert Comment

    by:Bob Learned
    Question #1:  Does 'astrFileNames' return anything (Length > 0)?


    Author Comment

    Yes it does
    as the matter of fact i don't think it's a problem with the code.
    I have downloaded the evaluation copy of winzip and i can unzip my folder and see all the files... weirrrrrrrrd but the version I was using was the free one that comes originally with Windows and was showing an empty folder
    LVL 96

    Accepted Solution

    It didn't look like you had anything wrong with the code, so I was thinking that it had to be something that I couldn't see.


    Author Comment

    thanks for your time anyway


    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
    Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    This video discusses moving either the default database or any database to a new volume.

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now