ZipFile.IsDirectory Property


Gets whether the file is directory.

[Visual Basic]
Public Property IsDirectory As Boolean
[C#]
public bool IsDirectory {get;}
[C++]
public: __property bool get_IsDirectory();
[JScript]
public function get IsDirectory() :Boolean;

Property Value

A bool value indicating whether the file is directory.

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 full 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
        Dim count As Integer = zs.Length

        For i As Integer = 0 To count - 1
            Dim z As ZipFile = zs(i)
            Console.WriteLine("Name: {0}", z.Name)
            Console.WriteLine("FullName: {0}", z.FullName)
            Console.WriteLine("Size: {0}", z.Length)
            Console.WriteLine("Compressed Size:{0}", z.CompressedSize)
            Console.WriteLine("Encrypted: {0}", z.Encrypted)
            Console.WriteLine("Is Directory: {0}", z.IsDirectory)
            Console.WriteLine("Creation Time: {0}", z.CreationTime)
            Console.WriteLine("Last Write Time: {0}", z.LastWriteTime)
            Console.WriteLine("Last Access Time: {0}", z.LastAccessTime)
            Console.WriteLine("Attributes: {0}", z.Attributes)         
        Next
    Catch ep As Exception
        Console.Write(ep.Message)
    End Try
End Sub

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

void Unzip( )
{
    try
    {
        ZipArchive oZip = new ZipArchive( "TryIt" );
        oZip.Load( "c:\\test.zip" );

        ZipFile [] zs = oZip.Files;
        int count = zs.Length;
        
        for( int i = 0; i < count; i++ )
        {
            ZipFile z = zs[i];
            Console.WriteLine( "Name: {0}", z.Name );
            Console.WriteLine( "FullName: {0}", z.FullName );
            Console.WriteLine( "Size: {0}", z.Length );
            Console.WriteLine( "Compressed Size:{0}", z.CompressedSize );
            Console.WriteLine( "Encrypted: {0}", z.Encrypted );
            Console.WriteLine( "Is Directory: {0}", z.IsDirectory );
            Console.WriteLine( "Creation Time: {0}", z.CreationTime );
            Console.WriteLine( "Last Write Time: {0}", z.LastWriteTime );
            Console.WriteLine( "Last Access Time: {0}", z.LastAccessTime );
            Console.WriteLine( "Attributes: {0}", z.Attributes );
        }
    }
    catch( Exception ep )
    {
        Console.Write( ep.Message );
    }
}

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

void Unzip( )
{
    try
    {
        ZipArchive *oZip = new ZipArchive( S"TryIt" );
        oZip->Load( S"c:\\test.zip" );

        ZipFile *zs[] = oZip->Files;
        int count = zs->Length;

        for( int i = 0; i < count; i++ )
        {
            ZipFile *z = zs[i];
            Console::WriteLine( S"Name: {0}", z->Name);
            Console::WriteLine( S"FullName: {0}", z->FullName );
            Console::WriteLine( S"Size: {0}", __box(z->Length));
            Console::WriteLine( S"Compressed Size:{0}", __box(z->CompressedSize));
            Console::WriteLine( S"Encrypted: {0}", __box(z->Encrypted));
            Console::WriteLine( S"Is Directory: {0}", __box(z->IsDirectory));
            Console::WriteLine( S"Creation Time: {0}", __box(z->CreationTime));
            Console::WriteLine( S"Last Write Time: {0}", __box(z->LastWriteTime));
            Console::WriteLine( S"Last Access Time: {0}", __box(z->LastAccessTime));
            Console::WriteLine( S"Attributes: {0}", __box(z->Attributes));
        }
    }
    catch( Exception *ep )
    {
        Console::Write( ep->Message );
    }
}