OTX Reference  
OpenTestSystem.Otx.Extensions.ZipHandling.Actions.UnZipFile Class Reference

Decompresses the ZIP file More...

Inheritance diagram for OpenTestSystem.Otx.Extensions.ZipHandling.Actions.UnZipFile:
Inheritance graph

Public Attributes

BooleanTerm _override
 Determines whether any already existing target file will be overridden or not. More...
 
ListTerm extensions
 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. More...
 
StringTerm source
 Contains the path to the to-be-decompressed ZIP file More...
 
StringTerm target
 Contains the path to the to extract the contents of the ZIP container to More...
 
- Public Attributes inherited from OpenTestSystem.Otx.Core.Actions.ActionRealisation
OtxLink validFor
 Validity of ActionRealisation. More...
 

Detailed Description

Decompresses the ZIP file

The UnZipFile activity to 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.

Exceptions
Exceptions.FileAlreadyExistsException
Exceptions.FileNotFoundException
Exceptions.ZipFormatException
Checker rules
CheckerRule.ZipFiles_Chk001 - type-safe UnZipFile

Syntax
ZipHandling.UnZipFile(StringTerm source, StringTerm target, ListTerm extensions, BooleanTerm override);
ListTerm extensions
Contains a list of file extension strings. Only files, that have the given file extension (e....
Definition: ZipHandling.cs:462
StringTerm target
Contains the path to the to extract the contents of the ZIP container to
Definition: ZipHandling.cs:400
StringTerm source
Contains the path to the to-be-decompressed ZIP file
Definition: ZipHandling.cs:384
Examples
// Local Declarations
// Flow
ZipHandling.UnZipFile("file:///D:/FileZipped.zip", "file:///D:/FolderUnZipped", {"part*"}, true);

Member Data Documentation

◆ _override

BooleanTerm OpenTestSystem.Otx.Extensions.ZipHandling.Actions.UnZipFile._override

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. If it evaluates to FALSE, an existing target file will cause an exception to be thrown. If the flag is omitted, it defaults to FALSE.

◆ extensions

ListTerm OpenTestSystem.Otx.Extensions.ZipHandling.Actions.UnZipFile.extensions

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. It is possible to provide strings that contain wildcard characters.These are used as placeholders for arbitrary characters. The characters are:

  • '*' (asterisk) for an arbitrary amount[0..*] of consecutive characters.
  • '?' (question mark) for exactly one arbitrary character.
    EXAMPLE:
    With the extension of ["log*"] the following files will match (amongst others):
  • File.log
  • File.log1
  • File.log_02
  • File.log.01
    The following file will not match:
  • File.3log
  • File.lg.log
  • File.zip
    EXAMPLE:
    With the extensions of ["t?t"] the following files will match (amongst others):
  • File.txt
  • File.tut
  • File.t1t
    The following files will not match:
  • File.tt
  • File.text
  • File.log
    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")

◆ source

StringTerm OpenTestSystem.Otx.Extensions.ZipHandling.Actions.UnZipFile.source

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

StringTerm OpenTestSystem.Otx.Extensions.ZipHandling.Actions.UnZipFile.target

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.