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?
.ZIP from Windows to Mac: folder structure lost – how to avoid that
archive-utilityzip
Related Question
- Windows – Can .zip folders created using Windows XP Pro be opened and extracted on Mac without any additional software
- Create a zip file using an Automator Service
- MacOS – How to zip from terminal without creating folder structure of path to folder
- MacOS – How to remove __MACOSX folder in a list of zip files (not a single zip file)
- MacOS – How to make and transfer secure (encrypted) ZIP files from Mac to PC
- How to zip a folder using the command line while maintaining its file structure
- Opened a zip file in a spam email which created a folder in the /net folder
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.