Aug 15, 2011 at 5:56 PM
Edited Aug 15, 2011 at 6:05 PM
Ok let me try to explain it better.
I zip the folder C:\Test\ which contains:
now i zip it with the following code (real code is more complicated, but to get you an idea of what I use):
using (ZipFile zip = new ZipFile())
zip.CompressionLevel = Ionic.Zlib.CompressionLevel.Level5
//zip.ProvisionalAlternateEncoding = Encoding.UTF8;
zip.AlternateEncoding = Encoding.UTF8;
zip.AlternateEncodingUsage = ZipOption.AsNecessary;
zip.UseZip64WhenSaving = Zip64Option.AsNecessary;
Unzip the zipfile with the following code:
ZipFile zip = ZipFile.Read("C:\Test.zip");
foreach (ZipEntry ze in zip)
ze.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently;
What happens now is, for each file in the zipfile the library creates a filename.ext.tmp while he unpacks the specific file of the ze.Extract.
That means, when it extracts helloworld.txt on ze.Extract(...); in the folder c:\test\ there will be a file called helloworld.txt.tmp till extract finishes (use big files to test).
I think that this is no problem at all, but, when C:\test already has a file called helloworld.txt.tmp and i try to extract helloworld.txt in that folder, the library just fails with the message, that the file already exists (the helloworld.txt.tmp, not
Normaly this never happens, but when i unpack a zipfile to a folder and a file in that zipfile fails to extract (for example crc check fails), then the library creates the .tmp file while extracting, fails to extract with an error (crc check) and leaves
the .tmp there. When I extract again now, the library tells me that the .tmp file already exists and fails again.
The ExtractExistingFileAction.OverwriteSilently does not apply for that .tmp files and the zip.TempFileFolder is just used for zip.save() but not for extraction (i tried to do a workaround with a tmp folder which i always clear before extracting something).
So far... I'm still working on this. I think I need to clear all .tmp files of the folders to which I will extract stuff (Wanted to avoid that solution, since I dont know if that folder does not need those .tmp files for something else).