Search .zip files for sizes

06
2014-04
  • Steve

    I have a directory with many .zip files. I wish to search through them to match an uncompressed file size (I am trying to find which .zip my file originated in, and the name's been changed). IDEALLY, I could say "ls -z /zipfiles | grep "123456" and ls would treat the .zip as a directory. Fuse might be made to work, but it only works with single files and is cumbersome.

  • Answers
  • BowlesCR

    Will something like this work?

    for i in *.zip ; do
      echo $i;
      unzip -l ${i} | grep "123456";
    done
    

  • Related Question

    windows xp - Missing (or Invisible) Files in a Zip File
  • Amy Anuszewski

    I've got a stumper here. I zipped up a directory of php, javascript, css, etc. files on a server running Centos. I used Firefox to download this zip file to a machine running Windows XP. The download completed, and I extracted the files. Many files I expected to see in the unzipped directory were not there. I chalked it up to human error.

    I zipped them up again, redownloaded and unzipped. Different files weren't there. Entire directories were missing.

    I tried using Winzip and the built in Windows compression. Same results. I inspected the zip file on the Windows machine, and the files clearly don't seem to be in there.

    So, I go back to the server and unzip the zip file on the server. All the files are there.

    I finally give up and go to my Mac and download the zip file and unzip it to a portable drive to sneaker net over to the windows machine.

    But, how this happened is stumping me. The file size on Windows and Centos match exactly. If the file did not come down completely, I would have seen an error and the zip wouldn't have opened. If I zipped the files incorrectly, they would not be in the zip when I pulled it down to the Mac. I can't imagine file permissions doing it, and none of this stuff is hidden or a special kind of file.

    Any thoughts?


  • Related Answers
  • Scott A. Lawrence

    If you're using the compressed files feature of XP to view these, I believe it has a problem handling certain zip files. I would suggest downloading a copy of 7-Zip and making that the default for handling zip files. That should prevent the missing file problem from happening to you in the future.