I’m creating a zip file using the class FastZip from SharpZipLib and once I after I close the program, I cannot delete the file because:
‘Cannot delete zip.zip: It is being used by another person or program. Close any programs that might be using the file and try again.’
The code that is generating the file is simply this:
fZip.CreateEmptyDirectories = true; fZip.CreateZip(filesPath + '\\' + this.zipName, filesPath, false, this.zipFilter);
I tried using:
using (FastZip fZip = new FastZip()) { try { fZip.CreateEmptyDirectories = true; fZip.CreateZip(filesPath + '\\' + this.zipName, filesPath, false, this.zipFilter); } catch (Exception) { } }
But it doesn’t convert to iDisposable
Perhaps antivirus is busy checking the file? If not, then get a program that can tell you which programs have files open.
You can look at: