Extensions.ZipHandling.UnZipFile
Classification
Name | UnZipFile |
Short Description | Decompresses the ZIP file |
Class | Action |
Extension | OTX ZipHandling extension |
Group | ZipHandling related Actions |
Exceptions | FileAlreadyExistsException FileNotFoundException ZipFormatException |
Checker Rules | ZipFiles_Chk001 |
Standard Compliant | Yes |
OTL Syntax
ZipHandling.UnZipFile(StringTerm source, StringTerm target, ListTerm extensions, BooleanTerm override);
Description
Decompresses the ZIP file denoted by the given source path. The source path must point to a valid ZIP container (the file extension need not to be .zip).
It is possible to control which files to extract by passing in a pattern. Only the files that match the pattern will be extracted (including the folder structures they are contained in). Furthermore it is possible to specify whether any existing target files will be overridden or not. If the corresponding flag is set to TRUE, then any existing target file will be silently overridden.
Otherwise, if the flag is set to FALSE and a to-be-written file in the target location already exists, an exception is thrown.
Properties
Name | Data Type | Class | Default | Cardinality | Description |
Source | String | Term | - | [1..1] | Contains the path to the to-be-decompressed ZIP file. The path will be a URI, relative to the OTX_HOME directory. If the ZIP file denoted by this path does not exist, is not accessible or is not a valid ZIP container, an exception is thrown. |
Target | String | Term | - | [1..1] | Contains the path to the to extract the contents of the ZIP container to. The path will be a URI, relative to the OTX_HOME directory. If the target location denoted by this path contains any file that is to be extracted and the override flag is not set or set to FALSE, then an exception is thrown. |
Extensions | List | Term | - | [0..1] | The extensions element is a List of Strings. It contains a list of file extension strings. Only files, that have the given file extension (e.g. "txt": files ending with .txt) will be unpacked from the zip file. This element is optional and if omitted, no filtering is performed, unpacking any file with any file extension. In case, that files without an extension will be unzipped an empty string is used. |
Override | Boolean | Term | - | [0..1] | Determines whether any already existing target file will be overridden or not. If the flag evaluates to TRUE, an existing target file will be silently overridden. |
OTL Examples
/// Local Declarations
/// Flow
ZipHandling.UnZipFile("file:///D:/FileZipped.zip", "file:///D:/FolderUnZipped", {"part*"}, true);