0

I'm trying to add a file to a zip without creating a new zip.

I already tried using multiple libraries but none of them could do this without recreating a completely new zip file. The library i'm using is DotNetZip

Why I want to this is because i'm working with really big zip files and I just want to modify a existing file in the zip.

Botz3000
  • 39,020
  • 8
  • 103
  • 127
JariZ
  • 3
  • 2
  • 1
    Check http://stackoverflow.com/questions/1356003/c-sharp-sharpziplib-adding-file-to-existing-archive, it explains how it's done with DotNetZip. – Olaf Feb 12 '12 at 20:03
  • 1
    zip files (archives) are just not very well suited for this... Don't be deceived by a solution that only requires a few method calls, it may still be copying the whole file. – H H Feb 12 '12 at 20:15
  • @olaf That didn't do it :( Like i said, i want it to not create a whole new file – JariZ Feb 12 '12 at 20:29
  • 3
    part of the problem here is that the compression algorithm used by the zip file requires conceiving of the data as a stream. For a different input stream, the output stream has to be modified in more than one place, so even if you *could* modify the output in place, you would need to copy huge segments of it, to make room for changes elsewhere in the file. It's much simpler and hardly more time consuming to create a new file. – phoog Feb 12 '12 at 21:18
  • I think that if you use WinZip to mod a large file and spy at the files you'll see a `.tmp` file where it is copying to... – H H Feb 12 '12 at 21:45
  • Have you achieved this manually, with a zip file as huge as this one, using another program? If so, which one? – Hand-E-Food Feb 12 '12 at 21:49

1 Answers1

0

Well, ZIP components of our SecureBlackbox don't create new ZIP when you add or delete a file from existing ZIP. I.e. the stream is modified in-place.

Eugene Mayevski 'Callback
  • 45,135
  • 8
  • 71
  • 121