Hi I want to run winzip command in the following code. Can you suggest where I might be going wrong ?
Is it something to do with
WshShell.Run "C:\Program Files\WinZip\wzzip " &InitialFilePath &ZiplFilePath
here the Initial & ZipFilePath contain the paths for name of my zip file
Set objFSO = CreateObject("Scripting.Fi
leSystemOb
ject")
objStartFolder = "C:\Program Files\test\logs"
Set objFolder = objFSO.GetFolder(objStartF
older)
'Wscript.Echo objFolder.Path
Set colFiles = objFolder.Files
For Each objFile in colFiles
' Wscript.Echo objFile.Name
Next
Wscript.Echo
ShowSubfolders objFSO.GetFolder(objStartF
older)
Sub ShowSubFolders(Folder)
For Each Subfolder in Folder.SubFolders
'Wscript.Echo Subfolder.Path
Set objFolder = objFSO.GetFolder(Subfolder
.Path)
Set colFiles = objFolder.Files
For Each objFile in colFiles
'Wscript.Echo Subfolder.Path+"\"+objFile
.Name
Dim InitialString
InitialString = objFile.Name
' Wscript.Echo InitialString
' code to replace .log with .zip
Set RegularExpressionObject = New RegExp
With RegularExpressionObject
.Pattern = ".log"
.IgnoreCase = True
.Global = True
End With
Set expressionmatch = RegularExpressionObject.Ex
ecute(Init
ialString)
If expressionmatch.Count > 0 Then
ReplacedString = RegularExpressionObject.Re
place(Init
ialString,
".zip")
Dim ZipFilePath
Dim InitialFilePath
InitialFilePath = Subfolder.Path+"\"+Replace
dString
ZipFilePath = Subfolder.Path+"\"+Initial
String
Wscript.Echo InitialFilePath
Wscript.Echo ZipFilePath
' Dim objShell
' Set objShell = CreateObject("WScript.Shel
l")
' objShell.Run "C:\Program Files\WinZip\wzzip" ZipFilePath InitialFilePath"
dim WshShell
set WshShell = WScript.CreateObject("WScr
ipt.Shell"
)
WshShell.Run "C:\Program Files\WinZip\wzzip " &InitialFilePath &ZipFilePath
Set WshShell = nothing
End if
Set RegularExpressionObject = nothing
'"Program Files\WinZip\wzzip" C:\ZipScripttemp.zip C:\ZipScripttemp.pl
'ip(R) Command Line Support Add-On Version 1.1 SR-1 (Build 6224)
Next
Wscript.Echo
ShowSubFolders Subfolder
Next
End Sub
Start Free Trial