Command line zip everything within a directory, but do not include any directory as the root
It was Archive Utility's fault (a Mac OS X unzipper app). When I used the unzip command from the command line, it works great.
(cd MyFolder && zip -r -X "../MyFolder.zip" .)
Stumbled across this answer but didnt want to have to change in out of directories. I found the -j
option useful which adds all files to the root of the zip. Note that its is all files so subdirectory structure will not be preserved.
So with this folder structure:
MyFolder - MyFile1 - MySubFolder - MyFile2
And this command:
zip -rj MyFolder.zip MyFolder
You get this:
MyFolder.zip - MyFile1 - MyFile2
I found the easier way to make an encrypted zip file with the terminal app on mac (mac os) just from the files of your folder.
The command for the terminal
zip -j -e wishedname.zip yourfolder/*
That's it. Enjoy!
*
For more information to zip command in the terminal app
man zip
What -j and -e do?
-j--junk-pathsStore just the name of a saved file (junk the path), and do not store directory names. By default, zip will store the full path (relative to the current directory).-e--encryptEncrypt the contents of the zip archive using a password which is entered on the terminal in response to a prompt (this will not be echoed; if standard error is not a tty, zip will exit with an error). The password prompt is repeated to save the user from typing errors.