zipcompress
SOURCE
,
DESTINATION

The zipcompress statement compresses a file or an entire folder into a zip file (using ditto shell tool).


Parameters

This statement has two parameters:

source – file or folder to compress.

destination – name (and optionally path) of compressed output file. If this parameter is omitted, the output will be a .zip file with the same name and path as the original. If this parameter is included, it should end with .zip.


Description

This statement compresses a file or an entire folder using the ditto shell tool. The result will be either a .zip file. When compressing a folder this zip file is internally structured just as it would be if created using the Compress option in the Finder (the compress statement uses a different format when compressing folders).

The simplest way to use this statement is to compress in the same folder. If the file *Favorite Pony.png" is in the same folder as the current database, you can create a zip file named Favorite Pony.png.zip like this. The zip file will also be in the same folder as the current database.

zipcompress "Favorite Pony.png"

If the file is in a different folder, you can specify both the path and the file name, as shown below. The compressed file will be in the same folder as the original file.

zipcompress "~/Pictures/Utah/Favorite Pony.png"

You can compress an entire folder into a single file. This exammple will create a file named Pictures.zip in the user folder (it could take a while, though).

zipcompress "~/Pictures"

You can also specify a completely different location for the compressed file. This example saves the compressed file in a subfolder of the Documents folder.

zipcompress "Favorite Pony.png","~/Documents/Archive/Favorite Pony.png.zip"

Note: This statement is very similar to the compress statement. However, there are two significant differences. First, when compressing a folder the compress statement retains the full original folder paths of the content, the zipcompress statement does not (fyi, Apple’s Finder also does not retain full folder paths when creating zip files, so this statement is comparable to compressing via the Finder). The second difference is that the zipcompress statement can only produce .zip archive files, while the compress statement can also produce .tar.gz and .tar.bz2 archives.


See Also


History

VersionStatusNotes
10.2NewNew in this version.