View Single Post
Join Date: May 2007
Posts: 45
Reputation: cellus205 is an unknown quantity at this point 
Solved Threads: 1
cellus205 cellus205 is offline Offline
Light Poster

Parsing Zip Files VB.Net

 
0
  #1
Jul 25th, 2008
Hows it going everyone. Right now I am working on a project with VS2008 that parses directory and subdirectories and lists all filenames/paths/size/etc. This is working correctly, but I also need to parse the contents of zip files without actually unzipping them. What would be the easiest method to return the information on the files in a zip file? (Filename, Size, etc). Heres the code that I currently have to parse directories and subdirectories.

  1. Sub Parse(ByVal ThisFolder As String)
  2. FSO = New Scripting.FileSystemObject
  3. Dim soFolder As Folder
  4. Dim soFile As File
  5. Dim soFolders As Folders
  6.  
  7.  
  8. soFolder = FSO.GetFolder(ThisFolder)
  9.  
  10. ' Files in this directory
  11.  
  12. For Each soFile In soFolder.Files
  13. ' TestdbDataSet.Table1.Rows.Add(CStr(ThisFolder), CStr(soFile.Name), CStr(soFile.Type), CStr(soFile.Size))
  14. Table1TableAdapter.Insert(CStr(ThisFolder), CStr(soFile.Name), CStr(soFile.Type), CStr(soFile.Size))
  15. Next soFile
  16.  
  17. ' Recurse Subdirectories
  18. soFolders = soFolder.SubFolders ' parses subfolders
  19.  
  20. For Each soFolder In soFolders
  21. Parse(soFolder.Path)
  22. Next soFolder
  23.  
  24. soFolders = Nothing
  25. soFolder = Nothing
  26. soFile = Nothing
  27.  
  28.  
  29. End Sub
Last edited by cellus205; Jul 25th, 2008 at 1:02 pm.
Reply With Quote