I created these two zip files about 24 hours apart.

$ ls -l /tmp/*.zip
-rw-rw-r-- 1 scott scott 1401289 Mar 21 20:11 /tmp/inc1.zip
-rw-rw-r-- 1 scott scott 1401289 Mar 22 19:29 /tmp/inc2.zip

You can see they're the same size, because the directory being zipped hasn't changed.

However, these files have been viewed in the last 24 hours, so their access times have changed. For this reason, I can't compare the zips using diff or cmp.

What would a way to reliably compare their contents be? For example, I am considering comparing the output of

ls -l <file> | awk '{print $5}'

on the two files. Is there a better solution?



zipcmp compares the zip archives zip1 and zip2 and checks if they contain the same files, comparing their names, uncompressed sizes, and CRCs. File order and compressed size differences are ignored.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.