2

My machine runs Debian 6.0.7 and I have Zip 3.0 (July 5th 2008), by Info-ZIP. When I try to unzip a .zip file, 2~3 times out of 10 it would not extract everything. There would be 2-3 files missing.

At first I thought it was because of the file size and some limitations I didn't know but then I noticed it was doing that with small files of 150MB as well. Then i thought maybe it was because I was decompressing it through a bash script file so I tested with manually unzipping the files and again that wasn't the problem.

Finally today I checked it with a 140MB .zip file. I extracted the file both manually and using my .sh script 10 times and after each time I would run ls -h -R > ../test_n.txt to keep a record of the folder after each decompression. After comparing all 20 files I saw that 7 out of 20 times it would miss from 2 to 8 files from the .zip file.

Anybody has any idea why this might be happening?

1
  • 1
    Would you mind finding the smallest .zip file that shows this problem and post it on some file sharing site so some of us may download it and test it ourselves?
    – BenjiWiebe
    Commented Jul 3, 2014 at 3:21

1 Answer 1

1

I have absolutely no idea what might be happening... however, here's some stuff you can try in order to debug the problem:

  • If that zip version has a -l flag, or something else to check what files are within the zip file without decompressing it, that might help.

    zip -l file.zip
    

    That will show you the contents of the zip file, so you should expect the same quantity of files after unzipping it - you can use that as a test in your script, just to make sure that you are always decompressing all of them.

  • Are the zip files correct, indeed? If you are getting the file from another source, take a checksum of the file and then compare it with the zip file you are trying to unzip. If different, then corruption of the file might be the cause of this issue.

  • What is the return code for the zip command? After decompressing the file using zip, issue a echo $? command in order to check the return code for it - if different than zero, then the program is telling you that, in some way, the program execution was not successful overall. Please note that this value might vary, but as far as I know, using zero for success and other numbers for error/warning is pretty standard over unix/linux utilities.

I hope this helps :)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .