(VBScript) List Files in a .zip
How to list files within a .zip Note: This example requires Chilkat v11.0.0 or greater.
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)
success = 0
' This example requires the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.
set zip = CreateObject("Chilkat.Zip")
success = zip.OpenZip("a.zip")
If (success = 0) Then
outFile.WriteLine(zip.LastErrorText)
WScript.Quit
End If
' Get the number of files and directories in the .zip
n = zip.NumEntries
set entry = CreateObject("Chilkat.ZipEntry")
i = 0
Do While i < n
success = zip.EntryAt(i,entry)
If (entry.IsDirectory = 0) Then
' (the filename may include a path)
outFile.WriteLine(entry.FileName)
End If
i = i + 1
Loop
outFile.Close
|