Basically I'm trying to unzip some specific files in a zip file (there are lots of junk subfolders in it).
The thing is only the last subfolder contains files I want. Other subfolders won't contain any files except another subfolder.
Here is the code I'm currently using:
ZipFile="C:\Test.zip"
ExtractTo="C:\"
Set fso = CreateObject("Scripting.FileSystemObject")
If NOT fso.FolderExists(ExtractTo) Then
fso.CreateFolder(ExtractTo)
End If
set objShell = CreateObject("Shell.Application")
set FilesInZip= objShell.NameSpace(ZipFile).items
print "There are " & FilesInZip.Count & " files"
'Output will be 1 because there is only one subfolder there.
objShell.NameSpace(ExtractTo).CopyHere(FilesInZip)
Set fso = Nothing
Set objShell = Nothing
Is there anyway I can traverse subfolder and only unzip files with a specific extension?