This project is read-only.

Removing complete directory path from zip archive

Jun 17, 2011 at 4:04 PM

Whenever I use the following code:

using (ZipFile zip = new ZipFile())
            zip.Save(Server.MapPath("~//Images//" ));

to create a zip archive it produces a zip file but places the root files inside the full path of folders.

How can I create a zip archive and remove all the containing folders?

Thanks in advance.

Jun 18, 2011 at 7:00 AM

This is a FAQ.

Use the AddFile overload that accepts a second parameter, a string.  Pass "" (the empty string).

Check the documentation or the examples page on this website - the idea is explained in some detail.