Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a *zip containing a lot of pictures from the past year, and it compressed incorrectly and is missing its end statement. I've been using "zip -FF" in Terminal, but it keeps getting stuck on a *zip inside the *zip...

I'm not very well versed in what I'm doing, and I'm hoping someone could point me in the right direction to continue from here. The best I could come up with was:

zip -FF badzip.zip --out goodzip.zip -x "*.zip"

But it isn't working. There are other *zip files in there that copy without issue, but one in particular just stumps it. Thanks for your help!

share|improve this question
    
Some thoughts: 1) In the good old DOS days PK(UN)ZIP had a tool called PKZIPFIX, maybe that helps or you can find other ZIP repair tools. 2) Does your attempt stop at the bad file, or does it only skip the bad file? The corrupt file may be lost anyway, but if you can unpack the others at leat you have those. Many unpackers can do the 'skip' scenario, you'd have to look for a Mac unpacker that can do that. –  Jan Doggen Sep 16 '13 at 9:02
    
If you have access to a windows machine, I've found www.izarc.org/ to be good for dealing with corrupted archives. Not sure what is available for Macs. –  jam Sep 16 '13 at 9:35
    
Just some info: A zip file consists of a series of compressed files, each with a header including the name, size, compression scheme, etc. After all the individual files is a directory, which maps names to offsets in the zip file where the individual files begin. If the zip file is truncated the directory is lost, but the zip file can still be sequentially scanned to extract the individual files contained therein (that haven't also been truncated away). Normally this is what a "zip repair" tool would try first, I suspect, though one may have to fiddle with parameters to get this mode. –  Daniel R Hicks Sep 16 '13 at 17:00
add comment

1 Answer

You might be able to delete just the bad image from the archive by listing the contents and then deleting the last item selectively:

zip -sf badzip.zip
zip -d badzip.zip badfile.jpg

If listing doesn't work (because of the corruption) but you know which image is corrupted, you could try opening the archive in a text editor. TextWrangler will show you the file list. From there you can delete the contents of the corrupted file and try extracting.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.