Finder has a function create the zip file from the file or the folder. This zip file is different from the zip file Windows creates. This article says this zip file as Finder style zip file.
You can create this zip file from the terminal and the shell script. You can create it in the automated script.
This article explains that how to create the Finder style zip file and how to expand it.
Creating the Finder style zip file
You can create the Finder style zip file with
$ ditto -c -k --sequesterRsrc --keepParent Test Test.zip
Above line create the
Test.zip file by archiving the
-c option specify creates the archive,
-k option specify compress with
--sequesterRsrc option create the
__MACOSX folder to store the resource fork and the HFS meta data.
Specify only one file
If you create the zip file with only one file,
--keepParent option may be an obstacle. For example, following line create the zip file by archiving the
123.jpg file in the desktop.
$ ditto -c -k --sequesterRsrc --keepParent 123.jpg 123.zip
Expand it, the
Desktop folder will be created and the
123.jpg file is put in the created folder. Redundant folder will be created.
--keepParent option put the
Desktop folder which is a parent folder of the
It may be better to create without
--keepParent option if you create the zip file with only one file.
However, this is not good with the application package. The application package is looked like a simple file in the Finder, but it is a folder. The
--keepParent option is need to archive the application package.
Expanding the zip file
ditto can expand the zip file. Following line expand the Finder style zip file:
$ ditto -x -k TextEdit.zip ./
Above line expand the
TextEdit.zip file into the current directory. If you replace
./ with the destination folder,
ditto will create the destination folder and expand into it.
-x option expand the archive, and the
-k option indicate that the format of the zip file is the