Results 1 to 2 of 2

Thread: Browsing into Zip files and finding specific files ?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2000
    Posts
    84
    I found a module that has ZIP functionality features - but it's got no comments on how to pass an argument or request to it...

    What I'm trying to do is:
    > Find all *.zip files in a directory (*.zip in (say) C:\MyFolder)
    > Browse into each zip file and search for specific files (find any files that end in (say) *.txt)
    > Load those files into a list box


    I'd really appreciate any help - and espically the location of a zip functionality module that has comments or insturctions on how to use it.

    Thanks!

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Here's some work i did a while ago, maybe you could continue on it, zip's really a great compression format
    Code:
    'mPKZIP.bas 10.10.00 Kedaman
    'This is just a test, i dl the zip description from wotsit.org and thought
    'i could make my own unzipping library, here's what i have so far
    Type fileHeader
            Signature As Long
            version As Integer
            biflag As Integer
            packmethod As Integer
            lastmodtime As Integer
            lastmoddate As Integer
            crc32 As Long
            Sizepacked As Long
            Sizeunpacked As Long
            filenamelen As Integer
            extrafieldlen As Integer
    End Type
    
    Function FilesInZip() As String()
    Dim temp As fileHeader, buffer() As Byte, n As Long, result() As String
        Open "C:\windows\desktop\zip_form.zip" For Binary As 1
            Do
                Get #1, , temp
                'signature might be wrong if you have come to the directory section
                If temp.Signature <> 67324752 Then Exit Do
                ReDim buffer(temp.filenamelen - 1)
                Get #1, , buffer
                ReDim Preserve result(n)
                result(n) = StrConv(buffer, vbUnicode)
                'the third bit should determine if theres an extra descriptor
                Seek 1, Seek(1) + temp.Sizepacked - 6 * CBool(temp.biflag And 8)
                n = n + 1
            Loop While Loc(1) < LOF(1)
        Close #1
        FilesInZip = result
    End Function
    'to try this for instance in immediate window, type
    'For Each n In FilesInZip: ?n: Next n
    
    'Function Unzip(Fileindex As Long)
    '
    'End Function
    BTW, do you need recursive or nonrecursive directory search?
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width