Sample code for 30+ languages & platforms
DataFlex

List Files in a .zip

See more Zip Examples

How to list files within a .zip

Chilkat DataFlex Downloads

DataFlex
Use ChilkatAx-win32.pkg

Procedure Test
    Boolean iSuccess
    Handle hoZip
    Integer n
    Variant vEntry
    Handle hoEntry
    Integer i
    String sTemp1
    Boolean bTemp1

    Move False To iSuccess

    // This example requires the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    Get Create (RefClass(cComChilkatZip)) To hoZip
    If (Not(IsComObjectCreated(hoZip))) Begin
        Send CreateComObject of hoZip
    End

    Get ComOpenZip Of hoZip "a.zip" To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoZip To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    // Get the number of files and directories in the .zip
    Get ComNumEntries Of hoZip To n

    Get Create (RefClass(cComChilkatZipEntry)) To hoEntry
    If (Not(IsComObjectCreated(hoEntry))) Begin
        Send CreateComObject of hoEntry
    End

    Move 0 To i

    While (i < n)
        Get pvComObject of hoEntry to vEntry
        Get ComEntryAt Of hoZip i vEntry To iSuccess
        Get ComIsDirectory Of hoEntry To bTemp1
        If (bTemp1 = False) Begin
            // (the filename may include a path)
            Get ComFileName Of hoEntry To sTemp1
            Showln sTemp1
        End

        Move (i + 1) To i
    Loop



End_Procedure