set zip = CreateObject("Chilkat.Zip2")
Dim objFSO
Dim ofolder
Dim objStream
Dim strSearch
Dim strfolderSearch
Set objFSO = CreateObject("scripting.filesystemobject")
Set objStream = objFSO.createtextfile("c:\search.txt", True)
strfolderSearch = "D:"
strSearch = ".zip"
CheckFolder (objFSO.getfolder(strfolderSearch)), objStream
'MsgBox "File Search Completed." + vbCr + "Please check c:\search.txt for details."
Sub CheckFolder(objCurrentFolder, objtxtFile)
Dim strTemp
Dim strOutput
Dim objNewFolder
Dim objFile
Dim objStream
For Each objFile In objCurrentFolder.Files
strTemp = Right(objFile.Name, 4)
If UCase(strTemp) = UCase(strSearch) Then
strOutput = CStr(objFile.Name)
objtxtFile.writeline strfoldersearch + strOutput
ziplocation = strfoldersearch + "\" + strOutput
objtxtFile.writeline ziplocation
End If
Next
For Each objNewFolder In objCurrentFolder.subFolders
CheckFolder objNewFolder, objtxtFile
Next
' Any string unlocks the component for the 1st 30-days.
success = zip.UnlockComponent("Anything for 30-day trial")
If (success <> 1) Then
MsgBox zip.LastErrorText
WScript.Quit
End If
success = zip.OpenZip(ziplocation)
If (success <> 1) Then
MsgBox zip.LastErrorText
WScript.Quit
End If
' Set the password needed to unzip.
' This password must match the password used when the zip
' was created.
zip.SetPassword "Ech0p@ss"
' Returns the number of files and directories unzipped.
unzipCount = zip.Unzip("c:\extractedfiles")
If (unzipCount < 0) Then
MsgBox zip.LastErrorText
Else
wscript.sleep (9000)
End If
End sub
|