Skip to content

Instantly share code, notes, and snippets.

@comewalk
Created January 19, 2011 16:30
Show Gist options
  • Save comewalk/786409 to your computer and use it in GitHub Desktop.
Save comewalk/786409 to your computer and use it in GitHub Desktop.
extract all zip files in the directory
Set objShell = CreateObject("Shell.Application")
Set objWshShell = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
Set folder = fso.GetFolder(objWshShell.CurrentDirectory)
Set files = folder.Files
For each folderIdx In files
ZipFile=folderIdx.Name
ExtName = LCase(fso.GetExtensionName(folderIdx.Name))
If ExtName = "zip" Then
ExtractTo=objWshShell.CurrentDirectory
If NOT fso.FolderExists(ExtractTo) Then
fso.CreateFolder(ExtractTo)
End If
'Extract the contants of the zip file.
Set FilesInZip=objShell.NameSpace(objWshShell.CurrentDirectory & "\" & ZipFile).items
objShell.NameSpace(ExtractTo).CopyHere(FilesInZip)
End If
Next
Set objWshShell = Nothing
Set objShell = Nothing
Set fso = Nothing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment