Solved How to unzip all the files in a particular path

July 8, 2014 at 01:10:51
Specs: Windows 7
Hi, I have used the below code for unzipping the files in VB but it is unzipping only when the file name is given in script but i need to zip all the files in a particular path ..Can you plz help on this?

'The location of the zip file.
'The folder the contents should be extracted to.

'Extract the contents of the zip file.
set objShell = CreateObject("Shell.Application")
set FilesInZip=objShell.NameSpace(ZipFile).items
Set fso = Nothing
Set objShell = Nothing

message edited by Arunkumar11

See More: How to unzip all the files in a particular path

Report •

July 13, 2014 at 11:04:59
✔ Best Answer
We need to get more VBScripters here, I swear.
Const zipPath = "C:\test"
Const extractTo = "C:\out\test"

Set fso = CreateObject("Scripting.FileSystemObject")
Set shell = CreateObject("Shell.Application")
Set zipFolder = shell.Namespace(zipPath)
Set destFolder = shell.Namespace(extractTo)
Set items = zipFolder.Items : items.Filter &H100E0, "*.zip"
For Each zip In Items
  destFolder.NewFolder fso.GetBaseName(zip.Path)
  shell.Namespace(fso.BuildPath(extractTo, fso.GetBaseName(zip.Path))) _
   .CopyHere shell.Namespace(zip).Items, &H214
Next 'zip
WScript.Echo "Done"

How To Ask Questions The Smart Way

message edited by Razor2.3

Report •
Related Solutions

Ask Question