Hi, I'm using the code below to wite the output of a commandline tool to STDOut and STDErr to find out if an error occured. What I'd like to do is remove the files shown in the STDOut if no error occured in STDErr.
STDOut: shows the entire processCode:Option Explicit Private Sub Command1_Click() Dim wsh As IWshRuntimeLibrary.WshShell Dim wshExec As IWshRuntimeLibrary.wshExec Dim STDErrResults As String Dim STDOutResults As String Set wsh = New WshShell Set wshExec = wsh.Exec("C:\unrar.exe x " & "D:\Archives\My.Video.part1.rar" & " " & "D:\") STDOutResults = wshExec.StdOut.ReadAll STDErrResults = wshExec.StdErr.ReadAll If STDErrResults = "" Then 'Delete all the files shown in STDOutResults End If End Sub
STDErr: shows the error that occured (shows nothing if there was no error)
This is what gets written to STDOut:
If no error occured, then I want to delete all these files:Code:UNRAR 3.50 freeware Copyright (c) 1993-2005 Alexander Roshal Extracting from D:\Archives\My.Video.part1.rar Extracting D:\My.Video.avi Extracting from D:\Archives\My.Video.part2.rar ... My.Video.avi Extracting from D:\Archives\My.Video.part3.rar ... My.Video.avi Extracting from D:\Archives\My.Video.part4.rar ... My.Video.avi Extracting from D:\Archives\My.Video.part5.rar ... My.Video.avi Extracting from D:\Archives\My.Video.part6.rar ... My.Video.avi Extracting from D:\Archives\My.Video.part7.rar ... My.Video.avi Extracting from D:\Archives\My.Video.part8.rar ... My.Video.avi OK All OK
D:\Archives\My.Video.part1.rar
D:\Archives\My.Video.part2.rar
D:\Archives\My.Video.part3.rar
D:\Archives\My.Video.part4.rar
D:\Archives\My.Video.part5.rar
D:\Archives\My.Video.part6.rar
D:\Archives\My.Video.part7.rar
D:\Archives\My.Video.part8.rar
Is there a way to read all these files from STDOut and delete them ?




Reply With Quote