【发布时间】:2015-05-13 20:02:18
【问题描述】:
基本上我正在尝试将一些特定文件解压缩到一个 zip 文件中(其中有很多垃圾子文件夹)。
问题是只有最后一个子文件夹包含我想要的文件。其他子文件夹不会包含除另一个子文件夹之外的任何文件。
这是我目前正在使用的代码:
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
无论如何我可以遍历子文件夹并仅解压缩具有特定扩展名的文件吗?
【问题讨论】:
标签: vbscript