How to not preserve full file path in zip file

May 13, 2011 at 7:35 PM

Noticing that when I do a zipfile.save() the full file path of the files being added to the zip file is getting preserved.  For example if c:\temp1\test.txt is added to c:\temp2\file.zip, when I navigate the contents of c:\temp2\file.zip it shows \temp1\tes.txt.  I guess I'm looking for the equivalent of Winzip's "Save full path info" or rather the ability to "uncheck" that option.  Does this exist in DotNetZip?  Thanks for a great product.

Steve

 

Coordinator
May 19, 2011 at 8:14 PM

yes, call ZipFile.AddFile(filename, "");

This is a FAQ.  Search the discussions archive, and you will see full code examples.