Getting Error while Extracting Zip File

Aug 16, 2012 at 12:00 PM

Hi ,

i am using Ionic.Zip dll, Version 1.9.1.8 for For Extracting Zip file. The code is like below

string

 

 

zipToUnpack = sourcePath;

 string

 

 

unpackDirectory = destinationPath;

 using (ZipFile zip1 = ZipFile

 

 

 

 

 

 

.Read(zipToUnpack))

{

 

 

// here, we extract every entry, but we could extract conditionally

// based on entry name, size, date, checkbox status, etc.

foreach (Ionic.Zip.ZipEntry ex in

zip1)

{

ex.Extract(unpackDirectory,ExtractExistingFileAction

.OverwriteSilently);

}

}

 

i am unable to unzip file using this code i am getting bellow error

 
System.Exception: Error unzipping file "F:\ipmt\North1\Jul12\KASY339A.08062012.163643.ZIP"

---> Ionic.Zip.ZipException: Cannot read that as a ZipFile ---> Ionic.Zip.BadReadException: 

 Bad signature (0x00905A4D) at position  0x00000000
   at Ionic.Zip.ZipEntry.ReadHeader(ZipEntry ze, Encoding defaultEncoding)
   at Ionic.Zip.ZipEntry.ReadEntry(ZipContainer zc, Boolean first)
   at Ionic.Zip.ZipFile.ReadIntoInstance_Orig(ZipFile zf)
   at Ionic.Zip.ZipFile.ReadIntoInstance(ZipFile zf)
   --- End of inner exception stack trace ---
   at Ionic.Zip.ZipFile.ReadIntoInstance(ZipFile zf)
   at Ionic.Zip.ZipFile.Read(String fileName, TextWriter statusMessageWriter, Encoding

encoding, EventHandler`1 readProgress)
   at Ionic.Zip.ZipFile.Read(String fileName)
   at FileExtractor.ExtractFile.UnzipDataFile(String sourcePath, String destinationPath)
   --- End of inner exception stack trace ---
   at FileExtractor.ExtractFile.UnzipDataFile(String sourcePath, String destinationPath)
   at North1FileUpLoadService.North1FileUpLoadService.fileSystemWatcher_Created(Object

sender, FileSystemEventArgs e)

But for some files it is working perfectly.

we did R&D on this Issue. we compared both zip files one is extracting and another onc is not extracting then we found one small difference in ZIP file which is not extracting. The Difference in  "Packed" Property values. Packed Property has 0(ZERO) for Error ZIP File. is this reason for getting error? to see Packed Proferty double click on zip file

  



Sep 5, 2012 at 3:47 PM

using V 1.8 on .net CF i have just got almost the same exact error.

on a windows desktop system 7-zip says the zip file is fine and had no errors.

if i remove 1 file from the zip then it works.

which file does not seem to matter.

it's like the number of files in the archive can make it un readable,  4 files and it errors.... 3 files and it's ok ??

never saw this error before.