ZipFile.AddDirectory and 'exclusions'

Dec 27, 2012 at 6:13 PM


I am using the ZipFile AddDirectory() methods to build a ZIP file. Is there a way to trap the addition of every folder and file inside that directory structure BEFORE it is added to the archive?  Or is there a way to specify "exclusions"?

For example, to zip "C:\MyDocs" entirely, I can use this:

ZipFile zip = new ZipFile();
zip.AddDirectory("C:\MyDocs", "C:\MyDocs");

But, inside C:\MyDocs, I want to
skip folder C:\MyDocs\Downloads\ (recursively)
and skip file C:\MyDocs\Temp\readme.txt.

Is there a way to do that using the zip.AddDirectory() methods?

Thank you in advance for any suggestions.