Adding files to an existing zip

Apr 12, 2011 at 6:02 PM

I have a zip file with files already in it and I'm trying to just add new records in it while keeping the original files in it. When I do the following it just overwrites the zip file I already have.

 

 Dim masterzip As ZipFile
            masterzip = New ZipFile

masterzip.AddFile(fi.FullName)

masterzip.Save(My.Settings.masterzip.ToString)

 

I can't find a way to append files into a zip without fully extracting the zip and then adding my file then zipping it up again. Any ideas?

Apr 12, 2011 at 6:23 PM

Is there a way to say that my zipfile is an exiting file instead of saying its a new zip file??? Can I state the path of the zip that I want to add files to?

Coordinator
Apr 13, 2011 at 12:14 PM

yes - use the ZipFile constructor that accepts a path.

Check the documentation for more information. http://dotnetzip.codeplex.com/documentation

Jun 9, 2014 at 6:26 AM
Hi, you can use ZipFile.Read() method
using (var zip = ZipFile.Read("Your existing file.zip"))
{
    zip.AddFile("New File.txt");
    zip.Save();
}
Jun 9, 2014 at 8:31 AM
this library works with Windows phone?