Remove;
Remove();
The Remove method removes the current element from archive.
Executing the example requires the archive: D:\Work\Archives\Data.zip. The Old folder is added to the archive.
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;
Begin
ZIP := New ZipArchive.Create("D:\Work\Archives\Data.zip", ZipMode.Update);
ZIPEntry := ZIP.ItemByName("Old/");
If Not IsNull(ZIPEntry) Then
ZIPEntry.Remove;
End If;
Dispose ZIP;
End Sub UserProc;
Imports Prognoz.Platform.Interop.ForeIO;
Public Shared Sub Main(Params: StartParams);
Var
ZIP: IZipArchive = New ZipArchiveClass();
ZIPEntry: IZipArchiveEntry;
Begin
ZIP.Create("D:\Work\Archives\Data.zip", ZipMode.zmUpdate, ZipCompressionLevel.zcDefaultCompression);
ZIPEntry := ZIP.ItemByName["Old/"];
If ZIPEntry <> Null Then
ZIPEntry.Remove();
End If;
System.Runtime.InteropServices.Marshal.ReleaseComObject(ZIP);
End Sub;
After executing the example the Old folder is removed from the Data.zip archive.
See also: