Newsgroups: microsoft.public.vb.general.discussion
From: "Mike D Sutton" <Mike.Sut...@btclick.com>
Date: Wed, 11 Jun 2003 16:27:58 +0100
Local: Wed 11 June 2003 16:27
Subject: Re: How to get the file names of in a zip file
> Could someone advice me on how i could You'll either need to use a third party .zip library, or parse the .zip > get the file names in a zip file. central directory structure. The format isn't _too_ tricky to parse, (Assuming you're not dealing with multiple spanned volumes, but even so, they're not really that much worse) since even when the file is encrypted, the file header (Including file names) data is stored unencrypted. A real rough overview of how to read a .ZIP file would be, enter a Do loop and read 4 bytes from the file, these 4 byte should be a zip signature but you're only interested in one type which comes at the start of the file, so check for 0x4034B50. If the signature matches then you're looking at a local file header structure which is declared as: '*** Seek back 4 bytes and read in the entire structure in one shot, or read in '*** Private Function TestZip(ByRef inFile As String) As Long Const ZipLocalFileHeadSig As Long = &H4034B50 ' Make sure file exists ' Get a free file handle and open the file ' Check for a local file header signatrue With ReadHead ' Print the compression percentage ' Work out how much extra data to skip over ' Seek to next record ' Increment file count Private Function FileExist(ByVal inFile As String) As Boolean Hope this helps, Mike - Microsoft Visual Basic MVP - You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||