Spanning Using An Existing ZipFile

Jul 12, 2011 at 3:48 AM

Hi,

 

I have an existing zip file. I would like to create a copy of this but saved using spans.

 

    using (var someZip = ZipFile.Read(@"c:\original.zip"))
    {
      someZip.MaxOutputSegmentSize := 65536;
      someZip.Save(@"c:\somezip.zip");
    }

 

Using dotnetzip-winformtool.exe I can open somezip.zip but if I try and extract the contents I get errors for some files.

 

For example

 

"faisled to extract entry somefile.txt  -- bad state (invalid block type)

 

Is this a reasonable thing to do ?

I tried creating a new file, adding documents and then saving in segments. This worked out but I would prefer to open existing file and then save in segments.

 

Cheers,

John

Coordinator
Jul 12, 2011 at 8:45 PM

I guess it seems like a reasonable thing to do, but I don't know if it will actually work.

I don't know every test in the test suite, there are now 350+ tests, but I don't recall actually testing the scenario you described.

There have been other problems reported related to spanned archives; I've fixed those in v1.9.1.6000 (the alpha version of v1.9.1.6), but these problems still exist in v1.9.1.5.   It may be that you are seeing the results of those kinds of things.  You might consider trying the download of v1.9.1.600, which is available since yesterday.

In the meantime I will also try to test this with both v1.9.1.5 and v1.9.1.6000 .

 

Jul 13, 2011 at 2:58 AM

Thanks for the reply. I tried with the latest code but I still get the problem.

 

Something else I looked into was adding files to an already existing zip that is using spanning.

 

For example

 

            foreach (var pdf in pdfFiles)
            {
                using (var outputZip = new ZipFile(@"c:\temp\span.zip"))
                {
                    outputZip.MaxOutputSegmentSize = 1417123;

                    outputZip.AddFile(pdf);

                    outputZip.Save();
                }
            }

 

When I call Save the second time through the loop there is already an span.z01 but an exception is raised in

Ionic.Zip.ZipSegmentedStream._SetWriteStream(UInt32 increment) in c:\DotNetZip\Zip Partial DLL\ZipSegmentedStream.cs:line 317

because its trying to delete span.z01 and it appears to have the file open.

What I'm trying to do is build a zip file and break it up into segments. I can't add all the files at the same time and I might need to open the file up a few times and add more files until completion.

Everything seems to work ok if I use 1 zip but when I try and make use of spanning I seem to run into problems.

 

Cheers,

John

 

 

 

Coordinator
Jul 13, 2011 at 7:51 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Coordinator
Jul 14, 2011 at 12:47 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Coordinator
Jul 14, 2011 at 1:13 AM

OK thanks John.

Try out the v1.9.1.6001 binary DLL .  I've reproduced the problem here, and implemented a fix for your 1st scenario:  read a regular zip and then save it to a spanned zip.  (the DLLs are on the downloads tab)

I haven't addressed the second scenario - read a spanned zip and then re-save it to the same name.  I need to think about that one a little more.