Difference between revisions of "Extensions.ZipHandling.UnZipFile"
(Edited by Ngoc Tran.) |
|||
(10 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | {{DISPLAYTITLE:OTX ''' | + | {{DISPLAYTITLE:OTX '''UnZipFile'''}}[[Category:ZipHandling]] |
== Classification == | == Classification == | ||
− | {{ClassificationActivity | UnZipFile | Decompresses the ZIP file | [[Action]] | [[Extensions. | + | {{ClassificationActivity | UnZipFile | Decompresses the ZIP file | [[Action]] | [[Extensions.ZipHandling|OTX ZipHandling extension]] | [[Extensions.ZipHandling#Actions|ZipHandling related Actions]]| [[Extensions.ZipHandling.FileAlreadyExistsException|FileAlreadyExistsException]] <br/> [[Extensions.ZipHandling.FileNotFoundException|FileNotFoundException]] <br/> [[Extensions.ZipHandling.ZipFormatException|ZipFormatException]] | [[Extensions.ZipHandling.ZipFilesChk001|ZipFiles_Chk001]]|}} |
== OTL Syntax == | == OTL Syntax == | ||
Line 10: | Line 10: | ||
== Description == | == 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). <br/> | 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). <br/> | ||
− | 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 | + | 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. <br/> |
Otherwise, if the flag is set to FALSE and a to-be-written file in the target location already exists, an exception is thrown. | Otherwise, if the flag is set to FALSE and a to-be-written file in the target location already exists, an exception is thrown. | ||
Line 16: | Line 16: | ||
{| {{TableHeader}} | {| {{TableHeader}} | ||
{{TableRowPropertiesHeader}} | {{TableRowPropertiesHeader}} | ||
− | {{TableRowPropertie2| Source| [[Core.DataTypes.SimpleDataType.String|String]] | [[Term]] | - |[1..1]| Contains the path to the to-be-decompressed ZIP file. The path | + | {{TableRowPropertie2| Source| [[Core.DataTypes.SimpleDataType.String|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.}} |
{{TableRowPropertie1| Target| [[Core.DataTypes.SimpleDataType.String|String]] | [[Term]] | - | [1..1] | Contains the path to the to extract the contents of the ZIP container to. <br/> | {{TableRowPropertie1| Target| [[Core.DataTypes.SimpleDataType.String|String]] | [[Term]] | - | [1..1] | Contains the path to the to extract the contents of the ZIP container to. <br/> | ||
− | The path | + | 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.}} |
{{TableRowPropertie2| Extensions| [[Core.DataTypes.ComplexDataType.List|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. <br/> | {{TableRowPropertie2| Extensions| [[Core.DataTypes.ComplexDataType.List|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. <br/> | ||
− | 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 | + | 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. <br/> |
It is possible to provide strings that contain wildcard characters. These are used as placeholders for arbitrary characters. The characters are: <br/> | It is possible to provide strings that contain wildcard characters. These are used as placeholders for arbitrary characters. The characters are: <br/> | ||
⎯ '*' (asterisk) for an arbitrary amount [0..*] of consecutive characters. <br/> | ⎯ '*' (asterisk) for an arbitrary amount [0..*] of consecutive characters. <br/> | ||
Line 43: | Line 43: | ||
⎯ File.text <br/> | ⎯ File.text <br/> | ||
⎯ File.log <br/> | ⎯ File.log <br/> | ||
− | '''IMPORTANT — Case sensitivity is platform dependent and may | + | '''IMPORTANT — Case sensitivity is platform dependent and may very depending on the underlying system. It might therefore be necessary to provide a list with upper case and lower case variants of the same extension (e.g. "txt" and "TXT")'''}} |
− | {{TableRowPropertie1| Override| [[Core.DataTypes.SimpleDataType.Boolean|Boolean]] | [[Term]] | - | [0..1] |Determines whether any already existing target file | + | {{TableRowPropertie1| Override| [[Core.DataTypes.SimpleDataType.Boolean|Boolean]] | [[Term]] | - | [0..1] |Determines whether any already existing target file will be overridden or not. <br/> |
If the flag evaluates to TRUE, an existing target file will be silently overridden. <br/> | If the flag evaluates to TRUE, an existing target file will be silently overridden. <br/> | ||
If it evaluates to FALSE, an existing target file will cause an exception to be thrown. <br/> | If it evaluates to FALSE, an existing target file will cause an exception to be thrown. <br/> |
Latest revision as of 07:38, 12 September 2019
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);