How to unzip multiple zip folders using VBscript?

大城市里の小女人 提交于 2020-08-20 14:19:41

问题


I need a VB script to unzip multiple different zip folders. I have this script - but it does not work.

Sub Unzip()  
Set fso = CreateObject("Scripting.FileSystemObject")
For Each f In fso.GetFolder("C:\Dal\").Files
  If LCase(fso.GetExtensionName(f)) = "zip" Then
    Unzip f.path, "C:\Dal"
  End If
Next
End Sub

回答1:


The NameSpace method doesn't support wildcards. Try something like this:

Set fso = CreateObject("Scripting.FileSystemObject")
For Each f In fso.GetFolder("C:\").Files
  If LCase(fso.GetExtensionName(f)) = "zip" And Left(f.Name, 11) = "DailySearch" Then
    Unzip f.Path, "C:\DailySearch"
  End If
Next


来源:https://stackoverflow.com/questions/63393176/a-vbscript-to-recursively-unzip-the-folders-within-a-zip-folder

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!