Login   /   Register

Extracting a ZIP file

Rate this article
     2 votes, average: 5 out of 52 votes, average: 5 out of 52 votes, average: 5 out of 52 votes, average: 5 out of 52 votes, average: 5 out of 5
Loading ... Loading ...
May 15th, 2008 by Yaron Assa

Windows XP has a built-in ZIP mechanism integrated into its file-system. We can easily use this to extract standard ZIP files with only a few commands:

   1: 'Variable Definition

   2: Dim sZIPFile

   3: Dim sExtractToPath

   4:  

   5: Dim oShell

   6: Dim oZippedFiles

   7:  

   8: 'Variable Initialization

   9: sZIPFile="C:\Source.zip"

  10: sExtractToPath="C:\Dest\InnerDir\"

  11: Set oShell = CreateObject("Shell.Application")

  12:  

  13: 'Get the contents of the ZIP archive

  14: Set oZippedFiles=oShell.NameSpace(sZIPFile).items

  15:  

  16: 'Copy the contents into the destination folder

  17: oShell.NameSpace(sExtractToPath).CopyHere(oZippedFiles)

  18:  

  19: 'Free Objects

  20: Set oZippedFiles = Nothing

  21: Set oShell = Nothing

  22:  

Posted in ZIP

2 Responses to “Extracting a ZIP file”

  1. fengyi_3 Says:

    [-]

    thank you very much

  2. shruti.pratapwar Says:

    [-]

    Thanks a lot ..
    I was searching for this only…but not getting proper solution…

    Now it works properly.

Leave a Reply

You must be logged in to post a comment.

This article was viewed 703 times