Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Zip files corrupt over 4 gigabytes - No warnings or errors - Did I lose my data?

Tags:

I created a bunch of zip files on my computer (Mac OS X) using a command like this:

zip -r bigdirectory.zip bigdirectory 

Then, I saved these zip files somewhere and deleted the original directories.

Now, when I try to extract the zip files, I get this kind of error:

$ unzip -l bigdirectory.zip Archive:  bigdirectory.zip warning [bigdirectory.zip]:  5162376229 extra bytes at beginning or within zipfile   (attempting to process anyway) error [bigdirectory.zip]:  start of central directory not found;   zipfile corrupt.   (please check that you have transferred or created the zipfile in the   appropriate BINARY mode and that you have compiled UnZip properly) 

I have since discovered that this could be because zip can't handle files over a certain size, maybe 4 gigs. At least I read that somewhere.

But why would the zip command let me create these files? The zip file in question is 9457464293 bytes and it let me make many more like this with absolutely no errors.

So clearly it can create these files.

I really hope my files aren't lost. I've learned my lesson and in the future I will check my archives before deleting the original files, and I'll probably also use another file format like tar/gzip.

For now though, what can I do? I really need my files.

Update

Some people have suggested that my unzip tool did not support big enough files (which is weird, because I used the builtin OS X zip and unzip). At any rate, I installed a new unzip from homebrew, and lo and behold, I do get a different error now:

$ unzip -t bigdirectory.zip testing: bigdirectory/1.JPG   OK testing: bigdirectory/2.JPG   OK testing: bigdiretoryy/3.JPG   OK testing: bigdirectory/4.JPG   OK : : file #289:  bad zipfile offset (local header sig):  4294967295   (attempting to re-compensate) file #289:  bad zipfile offset (local header sig):  4294967295 file #290:  bad zipfile offset (local header sig):  9457343448 file #291:  bad zipfile offset (local header sig):  9457343448 file #292:  bad zipfile offset (local header sig):  9457343448 file #293:  bad zipfile offset (local header sig):  9457343448 : : 

This is really worrisome because I need these files back. And there were definitely no errors upon creation of this zip file using the system zip tool. In fact, I made several of these at the same time and now they are all exhibiting the same problem.

If the file really is corrupt, how do I fix it?

Or, if it is not corrupt, how do I extract it?

like image 427
MikeC8 Avatar asked Nov 26 '14 14:11

MikeC8


People also ask

Can corrupt zip file be recovered?

Step 1 Launch File Repair Tool and select the "Repair ZIP File" option start to repairing the process. Step 2 Search corrupt ZIP file in local drive and select the specific corrupt ZIP files. Step 3 All corrupt ZIP files list in the result section and click the "Repair" button.

What does it mean when a zip file is corrupted?

ZIP files can get corrupted during the download process. If the download was interrupted, due to a power outage or an unexpected program closure even for a moment, unreadable data can end up becoming part of the downloaded ZIP file and make it difficult for the data to be extracted.

Can zip damage files?

WinZip compression is lossless. When you extract the files in a Zip file created by WinZip, the result will be exact, byte for byte duplicates of the original files. There is no loss of fidelity, no loss of image quality, and no change in data associated with zipping or unzipping.


2 Answers

Unzip below 6 seemingly fails, use

jar -xf <zipfile> 

if you have java installed, or yet another unzip before you write the file off.

See: https://serverfault.com/questions/235139/how-to-unzip-files-bigger-than-4gb

like image 65
Georg Avatar answered Oct 04 '22 03:10

Georg


Try 7z x

I had the same issue with unzip %x on Linux for a .zip file larger than 4GB, compounded with a only DEFLATED entries can have EXT descriptor error.

The command 7z x resolved all my issues though.

Be careful though, the command 7z x will extract all files with a path rooted in the current directory. The option -o allows to specify an output directory.

like image 42
Serge Stroobandt Avatar answered Oct 04 '22 04:10

Serge Stroobandt