IZipArchiveEntry.UnpackFile

Syntax

UnpackFile(Path: String);

Parameters

Path. Path to the folder, to which the current element must be unpacked.

Description

The UnpackFile method unpacks the current element to the specified hard drive folder.

Comments

If the current element corresponds with the folder, all folder contents is unpacked with saving of all internal folders and files hierarchy.

Example

Executing the example requires that the hard drive contains the archive: D:\Work\Archives\Data.zip. The archive contains folders and files, several of them can contain the Last text.

Add a link to the IO system assembly.

Sub UserProc;
Var
    ZIP: IZipArchive;
    ZIPEntry: IZipArchiveEntry;
Begin
    ZIP := New ZipArchive.Create("D:\Work\Archives\Data.zip", ZipMode.Read);
    For Each ZIPEntry In ZIP Do
        If ZIPEntry.ArchPath.IndexOf("Last") <> -1 Then
            ZIPEntry.UnpackFile("D:\Work\Files");
        End If;
    End For;
    Dispose ZIP;
End Sub UserProc;

After executing the example archive elements are checked, if their names contain the Last text. If names contain the specified text, this folder or file are unpacked to the specified directory.

See also:

IZipArchiveEntry