extract

Extract the data of a compressed file.

extract(format, source, target) → returns boolean

This function requires Lucee.  Not supported on Adobe ColdFusion, etc.

Argument Reference

format string
Required

The format of the compressed file.
Values:
  • bzip
  • bzip2
  • tbz
  • tbz2
  • tar
  • tar.bz
  • tar.gz
  • gzip
  • tgz
  • zip

source string
Required

Path (relative or absolute) to the source-file or a directory with zip-files.

target string
Required

Path (relative or absolute) to the directory, where you want to extract the data.

Examples
Sample code invoking the extract function

Extract a zip-file and save the data in the "output-directory".

extract("zip", "test.zip", "output-directory")

Extract all zip-files, which are stored in the "multiple-directory" and save the data in the "output-directory".

extract("zip", "multiple-directory", "output-directory")

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub