Check if zip file is damaged

11

2

How can I check whether a zip file is damaged? I know that with zip -F input.zip --out output.zip I can fix the file. But I could not find an option that only checks the file CRC.

I'm using Ubuntu 12.04.

ironsand

Posted 2013-07-15T05:21:38.767

Reputation: 1 757

Question was closed 2013-07-17T21:28:13.173

Thanks! So with unzip -t I can check if the zip file is damaged. Should I do something if similar question is already exist? – ironsand – 2013-07-16T09:42:30.620

I don't think you have sufficient rep yet, but if you want we can mark as duplicate for you. – Karan – 2013-07-16T15:12:38.320

The post you wrote give me enough information for me. Please mark this post as duplicate. – ironsand – 2013-07-16T16:18:02.467

Answers

20

I would use the -T / --test flag to check integrity.

akira

Posted 2013-07-15T05:21:38.767

Reputation: 52 754

I want only check file integrity without making zip file. thanks anyway! – ironsand – 2013-07-16T09:37:30.537

4which is what -T does: zip -T existing.zip – akira – 2013-07-16T09:57:09.517

1

You could md5sum command to check for the file integrity. This will generate a 128 bit hash string. You can generate the simultaneous hash string for the original zip file and compare both of them. You just have to run the following command to generate md5 checksum,

:~$ md5sum <filename>
<128 bit hash string> <filename>

If the string matches then the file is not damaged. It is a good and easy way to check file integrity.

pRAShANT

Posted 2013-07-15T05:21:38.767

Reputation: 171

As a precaution it's a good way. I'll use the command next time. Thanks! – ironsand – 2013-07-16T09:44:44.817