Archived Forum Post

Index of archived forum posts

Question:

Zip2 - How to extract all files from corrupted .ZIP file?

Oct 03 '14 at 23:45

While trying out ZIP2 I observed that it aborts unzipping/extracting operation at the point where it encounters error or corruption in the zip file.

Can we handle this and tell ZIP2 to skip all files that are corrupted and continue exacting rest of the files in the zip file?

TIA

Yogi Yang


Accepted Answer

One thought: If the zip archive headers are OK, and the corruption has to do with the compressed data within an entry, then check to see if you can write code that iterates over all of the files within the .zip. See the online examples at example-code.com for samples that demonstrate how to iterate over the entries in a zip archive. If this is possible, then you can get the ZipEntry object for each, and then unzip each entry individually. The corrupted ones will fail, but you should be able to ignore the failure and continue with the next loop iteration to get the next ZipEntry object, etc.


Answer

Unfortunately, I don't think it's possible.