Poncho

Ⓐ&♥

Unzipping a problematic archive

Nice little tip for unzipping problematic archives (.zip) from AskUbuntu.com. I downloaded a .zip archive and could not for the life of me unzip. I tried gunzip and unzip – both failed with the following errors:

Gunzip

$ gunzip foo.gzip
gzip: foo.gzip: unknown suffix -- ignored

Unzip

$ unzip foo.zip
Archive: foo.zip
    End-of-central-directory signature not found. Either this file is not
    a zipfile, or it constitutes one disk of a multi-part archive. In the
    latter case the central directory and zipfile comment will be found on
    the last disk(s) of this archive.
    unzip: cannot find zipfile directory in one of foo.zip or
    foo.zip.zip, and cannot find foo.zip.ZIP, period.

A similar question was posted on the forum AskUbuntu.com, and one suggestion was to use jar (the Java archive tool). Although the commenter on the forum did not give the reason why to use it, another comment suggested that the trick worked. I made a copy of my .zip archive and ran it:

Using Jar

$ jar xvf foo.zip
    created: foo/
    inflated: foo/file1.txt
    inflated: foo/file2.txt
    ...
    inflated: foo/file99.txt
    inflated: foo/file100.txt
    java.io.EOFException: Unexpected end of ZLIB input stream
        at java.util.zip.InflaterInputStream.fill(InflaterInputStream.java:223)
        at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:141)
        at java.util.zip.ZipInputStream.read(ZipInputStream.java:154)
        at java.util.zip.ZipInputStream.closeEntry(ZipInputStream.java:100)
        at sun.tools.jar.Main.extractFile(Main.java:934)
        at sun.tools.jar.Main.extract(Main.java:850)
        at sun.tools.jar.Main.run(Main.java:240)
        at sun.tools.jar.Main.main(Main.java:1147)

Source: http://robertnewmanconsulting.com/blog/2012/dec/19/unzipping-problematic-archive/