-2

I'm downloading a ZIP file from a website, the ZIP contains numerous JSON and XML files which I am then trying to unpack.

The problem I'm having is that unzip doesn't want to unpack the file:

unzip meta.zip
Archive:  meta.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 meta.zip or
        meta.zip.zip, and cannot find meta.zip.ZIP, period.

Same problem with 7z:

7z x meta.zip

7-Zip [64] 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18
p7zip Version 9.20 (locale=de_DE.UTF-8,Utf16=on,HugeFiles=on,12 CPUs)

Processing archive: meta.zip

Error: Can not open file as archive

The file itself is recognized as an HTML document for some reason:

file meta.zip
meta.zip: HTML document, UTF-8 Unicode text, with very long lines

My question is, how do I unzip this? Both Mac and Windows unzip it just fine.

Thanks!

  • 2
    I imagine that it is recognised as an HTML file because it is an HTML file, and not a zip file at all. Try less meta.zip and see what you get. – Michael Homer Jul 17 '15 at 8:22
  • 2
    probably it's a html file that redirects you to the actual zip-file. – Gerald Schneider Jul 17 '15 at 8:27
  • Yup, it's not an archive – neuron Jul 17 '15 at 8:36
  • As mentioned above, the ZIP contains separate JSON and XML files. Checking with "less" actually says it's an archive. – Alexander Volk Jul 17 '15 at 9:22
1

I think you've answered your own question. If file tells you it's an HTML file, that's why zip cannot open it - it's HTML rather than being a ZIP file containing HTML files. What is in the file? (you can check using, eg, less).

  • less meta.zip Archive: meta.zip meta.zip (END) – Alexander Volk Jul 17 '15 at 9:19
  • As mentioned above, the ZIP contains separate JSON and XML files. Checking with "less" just gives the above and says it's an archive. – Alexander Volk Jul 17 '15 at 9:21
  • That sounds odd, although less could be piping that file contents through a pre-processor first (via the LESSOPEN environment vairable). file should say something like "Zip archive data, at least v2.0 to extract" for a valid ZIP file. What does a cat of the file show? – mjturner Jul 17 '15 at 9:26
  • cat gives me proper HTML from an "unsupported browser" page, which seems weird. Opening the ZIP in Coda does nothing, opening it in MacVIM actually lists the files in the archive. – Alexander Volk Jul 17 '15 at 10:18
  • How did you download the (did you use a browser or did you use something like curl)? Can you paste screenshots of what you see in cat and MacVIM? The only thing I can think of is that it's a ZIP file created with no compression (-0 if using InfoZIP) - if displayed, you will see just the ZIP header and archive directory along with the uncompressed file contents. That said, file still says a zero compression file is a ZIP file (as it has the header). – mjturner Jul 17 '15 at 21:45
0

Maybe the archive really is damaged.

Refer to the man page of your zip for the --fix + --fixfix options for repairing archives.

Using --fixfix many times can repair this type of damage.

0

I'm almost certain you have a text file on your hands. It's simply the redirect to the true zip file. file is (to my knowledge) fairly reliable. Beyond that, less meta.zip will always produce the output: Archive: meta.zip meta.zip (END)

So it's not a reliable way to determine file type, as it solely relies on the extension.

To extract the file, simply re-download the archive using a web browser like Firefox, and perform unzip meta.zip to access your archive's contents.

0

You could try to use foremost or binwalk to extract the content of your file. Try "foremost filename" or "binwalk -e filename". You can install it (if don't have) using your package manager (normally yum or apt).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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