ZipArchive.Remove Method


Removes a single or multiple files from current zip file.

[Visual Basic]
Public Sub Remove( _
    z As ZipFile _
)

Public Sub Remove( _
    zfs() As ZipFile _
)
[C#]
public void Remove(
    ZipFile z
);

public void Remove(
    ZipFile[] zfs
);
[C++]
public: void Remove(
    ZipFile* z
);

public: void Remove(
    ZipFile* zfs __gc[]
);
[JScript]
public function Remove( 
    z: ZipFile
);

public function Remove( 
    zfs: ZipFile[]
);

Parameters

z
The ZipFile instance to remove.
zfs
The ZipFile array instance to remove.

Example

[Visual Basic, C#, C++] The following example demonstrates how to compress/decompress file with EACompression Zip Component. This sample doesn't demonstrates the events, please refer to Samples section to get the complete samples of EACompression.

[Visual Basic]
Imports EACompression

Sub Unzip()
    Try
        Dim oZip As New ZipArchive("TryIt")
        oZip.Load("c:\test.zip")
        Dim zs() As ZipFile = oZip.Files
        
        'remove the first file
        If zs.Length > 0 Then
            oZip.Remove( zs(0) )
        End If
      
        'remove all files
        'oZip.Remove( zs )
      
    Catch ep As Exception
        Console.Write(ep.Message)
    End Try
End Sub


[C#]
using System;
using System.Collections;
using System.IO;
using EACompression;

void Unzip( )
{
    try
    {
        ZipArchive oZip = new ZipArchive( "TryIt" );
        oZip.Load( "c:\\test.zip" );
        ZipFile [] zs = oZip.Files;
        
        // remove the first file
        if( zs.Length > 0 )
            oZip.Remove( zs[0] );

        //remove all files
        //oZip.Remove( zs );
    }
    catch( Exception ep )
    {
        Console.Write( ep.Message );
    }
}


[C++]
using namespace System;
using namespace System::Collections;
using namespace System::IO;
using namespace EACompression; 

void Unzip( )
{
    try
    {
        ZipArchive *oZip = new ZipArchive( S"TryIt" );
        oZip->Load( S"c:\\test.zip" );
        
        ZipFile *zs[] = oZip->Files;
        // remove the first file
        if( zs->Length > 0 )
            oZip->Remove( zs[0] );

        //remove all files
        //oZip->Remove( zs );
    }
    catch( Exception *ep )
    {
        Console::Write( ep->Message );
    }
}