The uncompress statement uncompresses a .zip, .tar.gz or .tar.bz2 file into a file or an entire folder.


This statement has two parameters:

source – file to uncompress.

destination – name (and optionally path) of uncompressed file or folder. If this parameter is omitted, the new file (or folder) will have the same name as the compressed file.


This statement uncompresses an archive file (must be either a .zip, .tar.gz or .tar.bz2 file). Depending on the contents of the archive, the result may be either a single file or an entire folder.

The simplest way to use this statement is to uncompress in the same folder. If the file Yellow Flower.png.zip is in the same folder as the current database, you can unzip it like this.

uncompress "Yellow Flower.png.zip"

This will create a file named Yellow Flower.png in the same folder as the current database.

The second parameter allows you to give the uncompressed file a different name, like this:

uncompress "Yellow Flower.png.zip","Golden Flower.png"

Use the archivecontents( function to save the file (or folder) using it’s original, uncompressed name (which is not necessarily the same as the current name of the archive). If the archive contains a folder the contents will be multiple lines, so the firstline( function is used to extract the primary name of the contents. In this example you don’t know for sure what the final file name will be – it depends on the original uncompressed file name.

uncompress "Yellow Flower.png.zip",firstline(archivecontents("Yellow Flower.png.zip"))

In addition to specifying the output name, you can also specify the exact location where the uncompressed file (or folder) will be placed.

uncompress "Yellow Flower.png.zip","~/Pictures/Golden Flower.png"

Here is a similar example, but for an entire folder.

uncompress "Spring Flowers.zip","~/Pictures/Spring Flowers (2016)"

See Also


10.0NewNew in this version.