How is it that during extraction of a zip, I get two files of the same name in the same path

7-zipzip

I'm extracting a zip (self-extracting, but that probably doesn't matter) and for a few files I'm getting a dialog asking me if I want to replace a file that was already extracted with a file that's just about to be extracted. At first glance I didn't understand how a zip could contain the same file in the same place more than once. I then browsed to the file in question using 7zip (or any tool) and found this:

enter image description here

The difference is in the block number. What's actually happening here?

Best Answer

Yes, the ZIP file format allows multiple files with the same name. Files in a ZIP aren't actually in directories but simply have a long name that optionally includes the path. And files are added to the ZIP by effectively concatenating them end to end. The only place where synonyms cause a problem in the ZIP format is with the directory, where presumably the later file replaces the earlier one. But when an entire ZIP file is extracted (vs. extracting individual files) the general approach is to ignore the directory and just extract the files in the order they appear in the ZIP.

The image shown is, of course, of the ZIP file contents, not a Windows directory.

Related Question