I have a windows service monitoring a folder (files are consistently dumped into), and archive them based on the file names.
But I keeping getting this problem, that the C: drive is run out of space. Finally I found out that:
1. DotNetZip won't clean the temp files in C:\Windows\Temp if an exception is thrown when doing zip.Save(). Am I doing something wrong that caused this?
2. The exception is DotNetZip cannot access that file because the file is locked by another process. This is probably true, but the files are coming from another computer through network share.
I haven't read DotNetZip's src code, but I am guessing it's opening the file in write mode??? but why? could someone explain this to me?
Here is my code:
There is no doubt that the zip file does exist all the time, so there is no way ZipFile.Read(zipFileFullName) will fail, and I have never got such exception.
using (ZipFile zip = ZipFile.Read(zipFileFullName))
zip.ForceNoCompression = true;
foreach (string fn in (ArrayList)flitem.Value)
zip.UpdateFile(fn, flitem.Key.ToString() + '-' + toDay + "_done");
catch (Exception ex)
Thanks in advance,