2

We need to compare the contents in each of 2 .zip files we have. Each .zip file has of different file extensions. Each .zip file also contains another .zip file and a couple of subdirectories.

We don't have the luxury to use zipcomp utility. How do we compare all the files in the 2 zip files and display the identical files to matching.txt output file and non-identical files to non-matching.txt output file ?

The whole idea is to find out which files in one zip file, produced by a build, has changed/modified in another later build run.

2 Answers 2

4

Command unzip -lv file.zip prints contents of the file.zip, including CRC32 of every file in the archive (get unzip for Windows at http://info-zip.org or Sourceforge).

Having this, you can simply use

unzip -lv file1.zip > list1.txt
unzip -lv file2.zip > list2.txt

and compare contents of list1.txt vs list2.txt using utility like diff or diffuse. If you want more automated approach, you can write simple Perl or Python script to compare these listing files (hint - use Perl hash or Python dictionary on every file CRC32 that was printed by unzip -lv.

1
  • Hi mvp thanks for responding; its a linux platform we are using
    – chz
    Apr 6, 2013 at 17:52
0

You can use and customize the open-source tool comp_zip, available here and here, that compares two Zip archives without writing any extra file. All is done in memory. On Linux, all you need to do is gprbuild -P zipada comp_zip. The source is in the file tools/comp_zip.adb.

You must log in to answer this question.

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