Updating archive when adding a folder with subfolder overwrites it

Jun 3, 2010 at 6:07 PM

When adding folders to an existing zip file the archive is overwritten with the following conditions...

1. If you add a folder that contains subfolders the original archive is overwritten.

2. if you add a folder that only contains files but specify a path in the archive that does not exist the result is the same as #1

3. If you add a folder that only contains files or only specify files to add it works fine.

 

I'm using:

Visual Studio 2008 SP1 (C#)

Windows 7

 

Coordinator
Jun 3, 2010 at 6:35 PM

Your message is not clear.

A zip archive can be overwritten when you call Save().

It won't have anything to do with whether you add folders with subfolders.

Suppose you instantiate a ZipFile with a filesystem file,  like this:

var zip = new ZipFile("myarchive.zip");

...or, like this:

var zip = ZipFile.Read("myarchive.zip");

If you later call zip.Save(), the original zip archive will be overwritten, with whatever is in the instance.