Directives 

INSERT FILE

Insert and Compress File into ZIP Archive

Format

INSERT FILE filename$ TO (chan [, ERR=stmtref] [,KEY=string$])

Where:

filename$

Path and filename of the file to compress and add to the ZIP file.

Note:
UNIX/Linux does not support appending a file to the ZIP archive if the filename contains either a \ (backslash) or a : (colon).

chan

Open file channel of the ZIP archive in which to insert the file.

string$

Path and filename of the added file as recorded in the ZIP archive. (Required only if this is different from filename$.)

stmtref

Program line number or statement label to which to transfer control.

Description

The INSERT FILE directive will compress a specified file on your system and append it to the end of the ZIP archive.

Note:
The INSERT FILE directive will not insert a directory, only a file. Attempting to insert a directory will result in an Error #3: Input/Output error on file.

A directory can be inserted using the WRITE RECORD directive. Any files in sub-directories on your system can be inserted.

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

See Also

EXTRACT FILE Extract Compressed File from ZIP Archive
Accessing ZIP Files

Example

open (hfn)"test.zip"
insert file "test" to (lfo)
close (lfo)