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.
-
Indicate the folder or file name to compress with its full path in the ORINAME parameter.
-
Enter the destination folder and ZIP file name with the full path in the DSTNAME parameter.
-
Select a compression option with one of the following values for the COMPRESSIONLEVEL parameter:
-
0: Optimal (default value)
-
1: Fastest
-
2: No compression
-
-
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.
INCLUDEOPTION exampleYou want to compress the following tree structure on your PC:
-
C:\Test\file1.txt
-
C:\Test\file2.txt
-
C:\Test\Example\file3.txt
INCLUDEOPTION value 0 1 2 ZIP file's tree structure -
Test\file1.txt
-
Test\file2.txt
-
Test\Example\file3.txt
-
file1.txt
-
file2.txt
-
Example\file3.txt
-
file1.txt
-
file2.txt
-
-
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.