Pros:
- Mac OS X file elements are retained if encoded and decoded using the correct
Mac OS X tools.
- Multiple items contained in a single file that is easily transferable using any mechanism.
- Compressed format saves storage space and bandwidth.
- Uses ZIP format that can be decoded on nearly any system.
Cons:
- Requires additional encoding and decoding steps.
- No file checksums to verify content.
- The Finder doesn’t support the creation of encrypted archives.
- The Finder doesn’t support modifying existing archives.
Disk Image Deployment
Pros:
- Mac OS X file elements are always retained.
- Multiple items or even entire file systems can be contained in a single file that is easily
transferable using any mechanism.
- File checksum helps verify content.
- Optional compressed format saves storage space and bandwidth.
- Optional encrypted format secures items from unauthorized access.
- Optional read/write format allows easy modification and expansion of disk image contents.
- Variety of advanced deployment uses beyond simple items.
Cons:
- Requires additional creation, mounting, and copying steps.
- Most third-party systems are not able to open the Mac OS X disk image format.
- Can be complex for inexperienced users.
Archiving for Deployment
Mac OS X has built-in support for archive files and supports ZIP, the most common file
archive format. Files saved in this format use the .zip filename extension as their identifier.
This format provides robust lossless compression and is accessible to every modern operating
system. In this section, you will learn how to archive items in ZIP files and how to
extract items from ZIP files.
Creating ZIP Archives
You can create a ZIP archive file from single or multiple items using the Finder or the
command-line tool zip. By default, creating a ZIP archive file using either method will not
delete the original documents you’ve selected to archive.
Creating ZIP Archives Using the Finder
To create a ZIP archive file in the Finder:
1 In the Finder, select the items you want to archive.
You can hold down the Shift key to quickly select contiguous lists of items, or hold
down the Command key to quickly select noncontiguous items.
Put all the items in one folder, and then compress the folder rather than
selecting multiple items. This extra step will help keep things orderly later, as the
items will end up in the same folder when they are extracted.
2 Choose File > Compress Items.
The word Items in the menu will be replaced by the name of the item you have
selected (if you selected just a single item) or the number of items you have selected
(if you selected multiple items).
If the archival process is going to take more than a few seconds, the Finder will show a
progress dialog with the estimated time required to complete the compression task. You
can also choose to cancel the archive by clicking the small X button on the far right.
When the archival process has completed, you will be left with a ZIP archive file
named either Archive.zip or Item.zip, where Item is the name of the single item you
chose to archive and compress. The ZIP archive file will be placed in the same location
as the original items.
Once the archive process is complete, it’s always interesting to compare the original items’
size with the archive’s size using the Get Info or Inspector windows in the Finder. In many
cases you can expect a 50 percent decrease in file size. On the other hand, many media
formats are already quite compressed in their original form, so you may not see much
change when compressing these types of files.
Creating ZIP Archives Using the Command Line
Mac OS X includes several command-line utilities that can create ZIP archive files, including
the tar, ditto, and gzip commands. However, only the tar command (short for “tape
archive”), which is built in to Mac OS X v10.5, properly archives all Mac OS Extended file
elements. This is because the tar command first creates a tape archive of the items and
then filters it through the gzip compression command.
Unfortunately, the use of tar to create ZIP archives does not create files that are compatible
with all third-party systems. In practice, though, one of the few reasons you would
choose the ZIP archive format for deployment is for its third-party compatibility. Thus,
from the command line you should use the zip command to create standard ZIP files that
are compatible with nearly any third-party system.
The syntax for compressing files and folders is zip -r followed by the path to the newly
created archive file including the .zip extension, and then the path(s) to the item(s) or
folder(s) you want to archive. |