Hi I am trying to get the number of files copied value from a logfile produce by a RoboCopy method within my application. The logfile is always in this format:
-------------------------------------------------------------------------------
ROBOCOPY :: Robust File Copy for Windows :: Version XP010
-------------------------------------------------------------------------------
Started : Thu Oct 10 10:08:51 2013
Source : \\ad\nas\Dev_Code\ITA\Stats\11.6.4.15\CFI\Build\
Dest : C:\inetpub\CFI\
Files : *.*
Options : *.* /FFT /NFL /TEE /S /E /COPY:DAT /Z /IS /R:5 /W:5
------------------------------------------------------------------------------
1 \\ad\nas\Dev_Code\ITA\Stats\11.6.4.15\CFI\Build\
------------------------------------------------------------------------------
Total Copied Skipped Mismatch FAILED Extras
Dirs : 1 0 1 0 0 0
Files : 1 1 0 0 0 0
Bytes : 1.62 m 1.62 m 0 0 0 0
Times : 0:00:03 0:00:02 0:00:00 0:00:00
Speed : 607364 Bytes/sec.
Speed : 34.753 MegaBytes/min.
Ended : Thu Oct 10 10:08:59 2013
So far I am able to read the file into a streamreader but is there anything I can do to ensure I am always selecting the last instance of Files : and then the value under the Total column i.e. 1. Below I am trying to split the string based on it being tab delimited but this is returning System.String[]
try
{
using (StreamReader r = new StreamReader(@"C:\LogFile.log"))
{
string line;
while ((line = r.ReadLine()) != null)
{
if (line.Contains("Files"))
{
String content = line.ToString();
char sep = '\t';
string[] splitContent = content.Split(sep);
Console.WriteLine(splitContent);
}
}
}
}
catch (Exception)
{
throw;
}