# Directives

EXTRACT FILE | Extract Compressed File from ZIP Archive

## Format

EXTRACT FILE filename$ FROM (chan [, ERR=stmtref] [,KEY=string$])

Where:

filename$ | Path and filename of the extracted file.
chan | Open file channel of the ZIP archive from which to extract the file.
string$ | Path and filename of the file in the ZIP archive to extract. (Required only if this is different from filename$.)
stmtref | Program line number or statement label to which to transfer control.

## Description

The EXTRACT FILE directive will decompress the specified file in the ZIP archive and will then create that file on your system with the path and filename specified.

#### Note:
The EXTRACT FILE directive will not extract a directory, only a file. Attempting to extract a directory will result in an Error #3: Input/Output error on file.
Directories do not need to be extracted because if a directory is found in a ZIP archive, the DIRECTORY directive can be used to create it on the system. Any files in directories within the ZIP archive can and will be extracted.

(The EXTRACT FILE directive was added in PxPlus 2016.)

## See Also

INSERT FILE Insert and Compress File into ZIP Archive
Accessing ZIP Files

## Example

open (hfn)"test.zip"
extract file "test" from (lfo)
load "test"
list
close (lfo)