188

I try to unzip a zip file, but got an error:

$ unzip COCR2_100.zip 
Archive:  COCR2_100.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.
note:  COCR2_100.zip may be a plain executable, not an archive
unzip:  cannot find zipfile directory in one of COCR2_100.zip or
        COCR2_100.zip.zip, and cannot find COCR2_100.zip.ZIP, period.

I googled but didn't find a solution. I was wondering why it is and how I should fix it? Thanks!

The zip file can be downloaded from COCR2_100. It is an application, and here is its website http://users.belgacom.net/chardic/cocr2.html.

My OS is 10.10.

Tim
  • 25,177
  • I was able to download and extract the program without any problems using the mirror link. Perhaps your download is corrupt? here is my md5sum output on the file: a55352aac3193948478952dea33828ef /home/chuck/Desktop/COCR2_100.zip – Ctuchik Jul 28 '11 at 20:10
  • 2
    If you md5sum the file and get the same result "a55352aac3193948478952dea33828ef" Then your download is good, but if it isn't EXACTLY the same, then your download is corrupt – Ctuchik Jul 28 '11 at 20:11
  • @Ctuchik: Thanks! The mirror one is good. The original one is broken. – Tim Jul 28 '11 at 20:44
  • np bud, glad i could be of service. – Ctuchik Jul 28 '11 at 20:44
  • 8
    Use the more robust jar xvf archive.zip, or try to fix the archive with zip -F archive.zip -O archive-fixed.zip (or -FF, see man zip). – Zaz Sep 27 '14 at 18:22
  • Future readers: if you encounter this error while trying to unzip a file from GitHub, try downloading the file with wget. More info here. – Dinei May 07 '17 at 19:17
  • Similar question on Stack Overflow: https://stackoverflow.com/questions/16261100/cant-download-github-project-with-curl-command – Andrew Grimm Jan 29 '19 at 23:50

6 Answers6

241

Try this excellent solution:

jar xvf COCR2_100.zip

steps:

  1. drag and drop file into terminal window.
  2. use keyboard arrows to navigate to start of line in terminal
  3. type jar xvf in front of your file name, remembering to leave space before the start of your file name.
  4. grab a beer and watch terminal work its magic as it extracts files.

The location of where the new files go varies, but usually best trick to find them is click on your computer name in Finder which should display most recent activity at top of all files.

If the jar command is not available, you can install fastjar by pasting the following in terminal:

sudo apt-get install fastjar
jbrock
  • 3,307
青色衣衫
  • 2,421
  • Why do you think it might really be a jar file? – Eliah Kagan Oct 06 '12 at 12:08
  • 11
    @EliahKagan it is not, but the trick works – Christoph Walesch Nov 28 '12 at 07:49
  • I found that the "fastjar" program works as well. It does not require Sun's openjdk. It can be installed from the Ubuntu package "fastjar". – loevborg May 09 '13 at 14:58
  • in my case the file was over 2G, so either the file system or chrome failed. However, this command did unzip the first 2G worth of data, and I downloaded the rest of what I needed a piece at a time. – JohnnyLambada May 29 '13 at 23:29
  • 1
    Java's jar uses the zip format internally, and it's not surprising that, one "unzipper" would handle corruption better than another. – Lambart Sep 20 '13 at 20:29
  • 3
    Wow this is exactly what I was looking for! Should def be the accepted answer. Any idea why this works? – Willem Ellis Jan 21 '14 at 00:10
  • 6
    I think this works for corrupt (or incompletely downloaded) files because the jar utility does not check for the End-of-central-directory signature before starting the extraction. If that really is the case, chances are you might not be able to extract every file and the utility might end with an error like Unexpected end of ZLIB input stream at the end. – Chirag Bhatia - chirag64 May 31 '14 at 19:45
  • 5
    Upvoted. Thank you: it was a headache to repair 6.5Gb zip with "zip -FF": produced "fixed" archive was tthe esact copy of damaged (incomplete) original one. I knew that .jar files are zips internally, but I never used the jar executable to unpack zip archives :-) – Troublemaker-DV Jun 07 '15 at 04:41
  • 1
    if you dont have jar command on ubuntu, try "aptitude install fastjar" or with apt-get as well – user169015 Jan 08 '16 at 11:51
  • This should be the accepted answer! – Arun Joseph Jul 25 '20 at 19:08
  • Winning answer. Because it fully answers the question with a more helpful solution. – Alexander Swann Sep 29 '20 at 12:32
  • Did not work for me, but the answer by Campa with 7z did the trick. – Cleb Mar 14 '21 at 15:50
  • Thank you very much, this worked a charm ! FireFox said the download were done, so I have no idea why that signature should be missing … Annyways, +1 ! – TheEagle Nov 02 '21 at 21:20
  • It does not work for me, It has it Ick! 0x3334449 after I issued the jar xvf file-name.zip. – Mohammad Jawad Barati Mar 27 '22 at 05:15
57

Unzipping with 7z worked for me:

7z x COCR2_100.zip

Install via APT with apt install p7zip-full.

Campa
  • 983
50

The problem is exactly what it says. Unzip can't find the line of code that signals the end of the archive, so either:

  1. The archive is corrupt.
  2. It is not a .zip archive.
  3. There are more than 1 parts to the archive, but that doesn't seem possible to me. You should try the other mirror too. It worked for me.

P.S. Notice how the program is made for Windows. So you need Wine (from http://www.winehq.com or the Ubuntu Software Center) to run it.

jokerdino
  • 41,320
Thomas
  • 548
  • 2
    It seems that "unzip" is not very robust and therefore cannot cope with corrupted (or incompletely downloaded) archives. – loevborg May 09 '13 at 14:59
  • Not exactly, I can unpack such file by Winrar or other popular Windows tools. Example file stanford-chinese-corenlp-2016-10-31-models.jar at http://nlp.stanford.edu/software/CRF-NER.shtml . – Mithril Feb 14 '17 at 06:45
8

I had a similar issue today and had some success with dd and gunzip. Try this:

dd if=corrupt.zip | gunzip -f > xx.csv

In my case I still got the "gunzip: stdin: unexpected end of file" error but at least I got some output to view.

gd2010
  • 81
8

Error can be caused by mixing up archive types:

I noticed that when using unzip, but on a gunzip (GNU) archive I would get this error, e.g.

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 create_tables.sql.gz or create_tables.sql.gz.zip, and cannot find create_tables.sql.gz.ZIP, period."

Using gunzip on this same archive performed without errors. !!

  • That did for my script which creates a zip file on the remote machine with gzip. unzip was failing. gunzip is working great now. – Augusto Feb 19 '21 at 19:09
1

I think the guys/gals that responded to you is on the right track it is very well a corrupted file. If that is the case then try another mirror to download the file. Your may try to install rar by opening terminal sudo apt-get install rar which for a true zip file rar is a little overkill. However it does add support for other formats and allows you to extracts different file types.

freebird
  • 386