ArchPath: String;
The ArchPath property returns the path to archive element.
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/.
Executing the example requires that the hard drive contains the archive: D:\Work\Archives\Data.zip.
Add a link to the IO system 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 original size: " + ZIPEntry.Size.ToString + " bytes." +
+ " Date of last modification: " + ZIPEntry.ModificationDate.ToString);
End If;
End For;
Dispose ZIP;
End Sub UserProc;
After executing the example the development environment console displays information about contents of the Data.zip archive.
See also: