Compressfiles

This 4GL function compresses folders or files into ZIP format on the application server.

Use COMPRESSFILES to create a ZIP file containing one or more files or a directory tree.

Syntax

RETURN_VALUE = func ORDSYS.COMPRESSFILES(ORINAME, DSTNAME, COMPRESSIONLEVEL, INCLUDEOPTION)

You need to specify the full path containing the destination directory.

  1. Indicate the folder or file name to compress with its full path in the ORINAME parameter.

  2. Enter the destination folder and ZIP file name with the full path in the DSTNAME parameter.

  3. Select a compression option with one of the following values for the COMPRESSIONLEVEL parameter:

    • 0: Optimal (default value)

    • 1: Fastest

    • 2: No compression

  4. Configure the INCLUDEOPTION parameter to specify the tree structure contained in the ZIP file:

    • 0: The root folder is included under the ZIP file's tree.

    • 1: Content is directly accessible at the root of the ZIP file without the root directory.

    • 2: Like option 1. However, only files are taken into account, and sub-directories are excluded.

If an error occurs, a status other than 0 is returned, and a trace file is created in the [TRA] folder. Otherwise, only a status equal to 0 is returned.