Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Making the content list of files inside a Zip ?
#6
This seems to work:
Code: (Select All)

Type ziphead
    signature As String * 4
    version As Integer
    flags As Integer
    compression As Integer
    modtime As Integer
    moddate As Integer
    crc_32 As Long
    compressedSize As Long
    uncompressedSize As Long
    filenameLen As Integer
    extrafieldLen As Integer
End Type

Dim i As Long
Dim filename As String
ReDim filelist(0) As String

filename = "yourfile.zip"
zipfilearray filename, filelist()
For i = 0 To UBound(filelist)
    Print Chr$(34); filelist(i); Chr$(34)
Next i

Sub zipfilearray (zipfile As String, strarr() As String)
    Dim head As ziphead
    Dim ff As Long
    Dim fname As String
    Dim filecount As Long
    ReDim strarr(0) As String
    If Not _FileExists(zipfile) Then Exit Sub
    ff = FreeFile
    Open zipfile For Binary As ff
    Do
        Get ff, , head
        If head.signature <> Chr$(&H50) + Chr$(&H4B) + Chr$(&H03) + Chr$(&H04) Then Exit Do
        fname = Space$(head.filenameLen)
        Get ff, , fname
        If filecount > UBound(strarr) Then ReDim _Preserve strarr(filecount) As String
        strarr(filecount) = fname
        filecount = filecount + 1
        Seek ff, Seek(ff) + head.extrafieldLen + head.compressedSize
    Loop Until EOF(ff)
End Sub
Reply


Messages In This Thread
RE: Making the content list of files inside a Zip ? - by visionmercer - 02-06-2024, 12:56 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  More info about Random Access files PhilOfPerth 28 883 02-25-2026, 01:50 PM
Last Post: ahenry3068
  Exiting sub while inside a loop PhilOfPerth 5 511 12-05-2025, 09:40 AM
Last Post: PhilOfPerth
  Embedding and Extracting MANY files ! ahenry3068 20 1,535 11-15-2025, 10:19 AM
Last Post: ahenry3068
  Erasing (or making a section of an image transparent) based on a mask from image #2? madscijr 17 2,433 04-14-2025, 09:19 PM
Last Post: madscijr
  List of file sound extensions eoredson 17 2,741 12-27-2024, 04:30 PM
Last Post: hsiangch_ong

Forum Jump:


Users browsing this thread: