Seems this would not be a deterministic thing, or is there a way to do this reliably?
相关问题
- iOS (objective-c) compression_decode_buffer() retu
- Is there a public implemention of LZSS compression
- Replace sequence of identical values of length > 2
- Reading and Compressing a picture with RLE
- Is there a maven plugin that can diff files and ou
相关文章
- c# saving very large bitmaps as jpegs (or any othe
- In R, find whether two files differ
- Interactively merge files tracked with git and unt
- Is there a commonly-used filename extension for un
- Diff for Powerpoint
- How to extract zip file using dotnet framework 4.0
- Removing trailing white space only for edited line
- Git: How to diff two different files in different
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.
sudo apt-get install zipcmp
If you're using gzip, you can do something like this:
A python solution for zip files:
Use as
It compares files line-by-line in memory and shows changes.
Beyond compare has no problem with this.
In general, you cannot avoid decompressing and then comparing. Different compressors will result in different DEFLATEd byte streams, which when INFLATEd result in the same original text. You cannot simply compare the DEFLATEd data, one to another. That will FAIL in some cases.
But in a ZIP scenario, there is a CRC32 calculated and stored for each entry. So if you want to check files, you can simply compare the stored CRC32 associated to each DEFLATEd stream, with the caveats on the uniqueness properties of the CRC32 hash. It may fit your needs to compare the FileName and the CRC.
You would need a ZIP library that reads zip files and exposes those things as properties on the "ZipEntry" object. DotNetZip will do that for .NET apps.
This isn't particularly elegant, but you can use the FileMerge application that comes with Mac OS X developer tools to compare the contents of zip files using a custom filter.
Create a script
~/bin/zip_filemerge_filter.bash
with contents:Make the script executable (
chmod +x ~/bin/zip_filemerge_filter.bash
).Open FileMerge, open the Preferences, and go to the "Filters" tab. Add an item to the list with: Extension:"zip", Filter:"~/bin/zip_filemerge_filter.bash $(FILE)", Display: Filtered, Apply*: No. (I've also added the filer for .jar and .war files.)
Then use FileMerge (or the command line "opendiff" wrapper) to compare two .zip files.
This won't let you diff the contents of files within the zip archives, but will let you quickly see which files appear within one only archive and which files exist in both but have different content (i.e. different size and/or checksum).