To create a .zip
file from the File manager:
To create a .zip
file from the command shell, you can use the following command:
zip archive.zip file [file]… |
To create a .zip
file from the File Explorer:
If the Java Development Kit is installed and in your PATH, you can also create a .zip
file from the command shell using the following command:
jar -cvf archive.zip file [file]… |
To create a .zip
file from the Finder:
To create a .zip
file from the command shell, you can use the following command:
zip archive.zip file [file]… |
If the Java Development Kit is installed and in your PATH, you can also create a .zip
file from the command shell using the following command:
jar -cvf archive.zip file [file]… |
Note that if you use the GUI-based approach, the resulting .zip
file will contain OSX-specific files (like .DS_STORE
) and directories (like __MACOSX
) that can cause problems in some situations. You can exclude files when working from the command line using the -x
option. For example:
zip -r dir.zip . -x .* -x __MACOSX
will create a dir.zip
that contains all of the directories below the current directory, but will exclude all files that start with a .
and the __MACOSX
directory.