compress
SOURCE
,
DESTINATION

The compress statement compresses a file or an entire folder.


Parameters

This statement has two parameters:

source – file or folder to compress.

destination – name (and optionally path) of compressed output file. This can just be an extension, for example .zip, .tar.gz or .tar.bz2, in which case the same name and path as the source will be used. If this parameter is omitted, the output will be a .zip file with the same name and path as the original.


Description

This statement compresses a file or an entire folder. The result will be either a .zip, .tar.gz or .tar.bz2 file.

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.

compress "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.

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

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

compress "~/Pictures"

If you want to use a different compression method, you can specify .tar.gz or .tar.bz2 in the optional second parameter.

compress "Favorite Pony.png",".tar.bz2"

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.

compress "Favorite Pony.png","~/Documents/Archive/Favorite Pony.png.tar.bz2"

For more information about the compression options available, see Lossless Compression (on Wikipedia).


See Also


History

VersionStatusNotes
10.0NewNew in this version.