I'm trying to parse a RoboCopy log to get the possible failures. An example of the end of the log is here:
I've managed to pull the lines of data I need:Code:Total Copied Skipped Mismatch FAILED Extras Dirs : 1 1 0 0 0 0 Files : 106 106 0 0 0 0 Bytes : 481.53 m 481.53 m 0 0 0 0 Times : 0:00:11 0:00:10 0:00:00 0:00:00
VB.NET Code:
Dim file_lines As String() = File.ReadAllLines("C:\log.txt") For Each line As String In file_lines If line.Length >= 10 Then Select Case True Case line.Substring(0, 10).ToLower.Contains("files :") Dim new_line As String = line.ToLower.Replace("files :", "") Me.txtFiles.Text = new_line.Trim Case line.Substring(0, 10).ToLower.Contains("dirs :") Dim new_line As String = line.ToLower.Replace("dirs :", "") Me.txtDirectories.Text = new_line.Trim Case line.Substring(0, 10).ToLower.Contains("bytes :") Dim new_line As String = line.ToLower.Replace("bytes :", "") Me.txtBytes.Text = new_line.Trim End Select End If Next
Which returns the data like this:
Which looks good. I know the index of columns I need to grab, but I don't how to pull that data from this string. Any ideas on how to get each column as needed? For example, if I only needed to grab column index 4, what would be the best way of doing it?
Thanks




Reply With Quote