This project is read-only.

Zipping files which may be open by other assemblies ?

Aug 16, 2012 at 12:57 PM

I'm writing a script in ASP.Net to zip up a bunch of logs and provide a download link.

The logs are the output of NLog and so my be being written to at the moment when a user requests a download.

How does DotNetZip deal with this situation ? I've got code which looks like this :


string selection = String.Format("(name = *.txt) AND (mtime > {0})", fiveDaysAgoAsISODate);
using (ZipFile zip = new ZipFile())
    zip.AddSelectedFiles(selection, fsDynamicContentPath, false);
    zip.Comment = "This zip was created at " + sDateNow;

I understand that nothing much will happen until the .Save gets executed but can anyone tell me what happens then if one of the selected files is open for writing ?