Sample code for 30+ languages & platforms
Visual FoxPro

List Files in a .zip

See more Zip Examples

How to list files within a .zip

Chilkat Visual FoxPro Downloads

Visual FoxPro
LOCAL lnSuccess
LOCAL loZip
LOCAL n
LOCAL loEntry
LOCAL i

lnSuccess = 0

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

loZip = CreateObject('Chilkat.Zip')

lnSuccess = loZip.OpenZip("a.zip")
IF (lnSuccess = 0) THEN
    ? loZip.LastErrorText
    RELEASE loZip
    CANCEL
ENDIF

* Get the number of files and directories in the .zip
n = loZip.NumEntries

loEntry = CreateObject('Chilkat.ZipEntry')

i = 0

DO WHILE i < n
    loZip.EntryAt(i,loEntry)
    IF (loEntry.IsDirectory = 0) THEN
        * (the filename may include a path)
        ? loEntry.FileName
    ENDIF

    i = i + 1
ENDDO

RELEASE loZip
RELEASE loEntry