IZipArchiveEntry.ArchPath

Syntax

ArchPath: String;

ArchPath: String;

Description

The ArchPath property returns the path to archive element.

Comments

If the current element corresponds with the file, the property returns the path and name of the file, for example, File.txt or Folder/File.txt.

If the current element corresponds with the folder, the property returns the path to the folder with the slash added at the end, for example, Folder/ or Folder/SubFolder/.

Example

Executing the example requires that the hard drive contains the archive: D:\Work\Archives\Data.zip.

Add a link to the IO system assembly. On working in Fore.NET, add a link to the ForeIO assembly.

Sub UserProc;
Var
    ZIP: IZipArchive;
    ZIPEntry: IZipArchiveEntry;
    i, c: Integer;
Begin
    //Read archive
    ZIP := New ZipArchive.Create("D:\Work\Archives\Data.zip", ZipMode.Read);
    c := ZIP.Count;
    
//View archive contents
    For i := 0 To c - 1 Do
        ZIPEntry := ZIP.Item(i);
        
If Path.GetExtension(ZIPEntry.ArchPath) = "" Then
            Debug.WriteLine(
"Folder: " + ZIPEntry.ArchPath);
        Else
            Debug.WriteLine(
"File: " + ZIPEntry.ArchPath + ". File source size: " + ZIPEntry.Size.ToString + " bytes." +
                + 
" Last modification date: " + ZIPEntry.ModificationDate.ToString);
        
End If;
    
End For;
    
Dispose ZIP;
End Sub UserProc;

Imports Prognoz.Platform.Interop.ForeIO;

Public Shared Sub Main(Params: StartParams);
Var
    ZIP: IZipArchive = 
New ZipArchiveClass();
    ZIPEntry: IZipArchiveEntry;
    PathCls: Path = 
New PathClass();
    i, c: Integer;
Begin
    
//Read archive
    ZIP.Create("D:\Work\Archives\Data.zip", ZipMode.zmRead, ZipCompressionLevel.zcDefaultCompression);
        c := ZIP.Count;
    
//View archive contents
    For i := 0 To c - 1 Do
        ZIPEntry := ZIP.Item[i];
        
If PathCls.GetExtension(ZIPEntry.ArchPath) = "" Then
            System.Diagnostics.Debug.WriteLine(
"Folder: " + ZIPEntry.ArchPath);
        Else
            System.Diagnostics.Debug.WriteLine(
"File: " + ZIPEntry.ArchPath + ". File source size: " + ZIPEntry.Size.ToString() + " bytes." +
                
" last modification date: " + ZIPEntry.ModificationDate.ToString());
        
End If;
    
End For;
    System.Runtime.InteropServices.Marshal.ReleaseComObject(ZIP);
End Sub;

After executing the example the development environment console displays information about contents of the Data.zip archive.

See also:

IZipArchiveEntry