Sample code for 30+ languages & platforms
Go

List Files in a .zip

See more Zip Examples

How to list files within a .zip

Chilkat Go Downloads

Go
    success := false

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

    zip := chilkat.NewZip()

    success = zip.OpenZip("a.zip")
    if success == false {
        fmt.Println(zip.LastErrorText())
        zip.DisposeZip()
        return
    }

    // Get the number of files and directories in the .zip
    n := zip.NumEntries()

    entry := chilkat.NewZipEntry()

    i := 0

    for i < n {
        zip.EntryAt(i,entry)
        if entry.IsDirectory() == false {
            // (the filename may include a path)
            fmt.Println(entry.FileName())
        }

        i = i + 1
    }


    zip.DisposeZip()
    entry.DisposeZipEntry()