Re: stderr / stdout: delete files if there's no error
Personally, I would find it better to just modify the Find_Files function to suit your needs. That way you can get just the files after "Extracting from" and none other. I would assume the lines with the files you need to delete all begin with "Extracting from", so you could just seek out those lines and get the filenames from there.
Also, Gremmy's method, while good, would not work correctly if they have a RAR file with a space in the file name. Worse if there is a space in the file path (i.e. any of the folders have a space in the name).
If the output maintains a standard (i.e. always says "Extracting from <archive name>" when it gets a RAR file to extract and says "Extracting <file name>" when it extracts a file inside), you could use a much simpler method:
Code:
Public Sub Find_Files(ByVal Input_string As String, ByRef File_array() As String)
Dim Tmp_Array() As String
Dim Tmp_Loop As Long
ReDim File_array(0)
Tmp_Array = Split(Input_string, vbCrLf, -1, vbTextCompare) 'Split each line into it's own string line..
For Tmp_Loop = 0 To UBound(Tmp_Array)
If Left$(Tmp_Array(Tmp_Loop), 15) = "Extracting from" Then
ReDim Preserve File_array(UBound(File_array) + 1)
File_array(UBound(File_array)) = Right$(Tmp_Array(Tmp_Loop), Len(Tmp_Array(Tmp_Loop)) - 16) '16 is the length of "Extracting from "
End If
Next
End Sub
That should work (you'll still get the first item in the passed array being blank).
Re: stderr / stdout: delete files if there's no error
Haha Snap Chaos...
Good Comments..
I am still to find a method to use that first item in the array...
Dont know why they made it that ubound wont return -1 for undimmed arrays... and why Redim Array (-1) errors
Grem....
Re: stderr / stdout: delete files if there's no error