.ZIP from Windows to Mac: folder structure lost – how to avoid that

archive-utilityzip

I am creating .zip-files on windows that I want to make available to Mac-Users (created with ZipFile.CreatefromDirectory from .NET Core). However, when I extract these files on my Mac (running Mojave, using the context-menu's "Extract File"), it re-creates the source-folder that I had zipped – and a flattened structure in side that folder: where I previously had root\foo\bar.txt, I now have a file "foo\bar.txt" in the root-folder. How I can get a "foo" folder with "bar.txt"? Did that problem arise when I build the .zip or do I need to extract differently in order to preserve directory-structure?

Best Answer

The default install of macOS does not have an "Extra File" context menu - it seems like that could be a third party program / plugin.

The default install of macOS comes with the Archive Utility for uncompressing for example ZIP files. It will preserve folder structure by default.

So in your case, either you're using a third party extractor, that does not by default preserve folder structure, or you have made a mistake when making the compressed file.

I would test by building a small test folder structure on the Mac, then select the top folder in Finder and choose "Compress" from the context menu. Now you'll have a ZIP-file that you can try uncompressing in a different folder. This should create the same folder structure that you initially compressed.