Archived Forum Post

Index of archived forum posts

Question:

"openzip" to open any file in the current folder?

Jul 24 '13 at 06:45

Hello,

I am looking for a way to get the openzip function to extract all files within a particular folder ending with the extension ".piz".

This is my current code but of course doesn't work:

   strTempPath = objFSO.GetSpecialFolder(intTemporaryFolder) & "\Temp Fedex Email Downloads\"  
   strPermPath = objFSO.GetSpecialFolder(intTemporaryFolder) & "\Fedex Email Downloads\"

     zip.DecryptPassword = "*censored*"

     success = zip.OpenZip(strTempPath & "*.piz")
     If (success <> 1) Then
         MsgBox zip.LastErrorText
         WScript.Quit
     End If

     '  Returns the number of files and directories unzipped.
     unzipCount = zip.Unzip(strPermPath)
     If (unzipCount < 0) Then
         MsgBox zip.LastErrorText
     Else
         MsgBox "Success! :D"
     End If

Any help will be much appreciated,

thanks, kind regards.


Answer

Check to see if you can use the UnzipMatching method.

For example: zip.UnzipMatching("c:/unzipdir","*/specificFolder/*.piz",false);