i have one folder in that 23 .txt file i want to get 15 to 22 files name and into files this way data so many lines "2014-09-01 00:00:01,500 [INFO] - Send List Count: 160. OK!" so i want that 160 numbers count in console application
result :
filename(date) count
2014-09-01 35086
2014-09-02 64589
.
.
.
2014-09-15 answer
.
.
2014-09-22 answer
plzz help me ????

shailesh parmarPosted Sep 24, 2014, 10:12 PM
but i have that kind of files in folder i send you and all files in lines
"2014-09-01 00:00:01,500 [INFO] - Send List Count: 160. OK!" this way so many but only that 160 likes so many numbers in each files i want to count and make total of that numebrs of 15 to 22 .txt files
and get result
2014-09-15 count
.
.
.
2014-09-22 count
Selva GanapathyPosted Sep 24, 2014, 8:03 AM
Hi Shailesh Parmar,
You can get the required output by using following code
public void Getfiles()
{
var files = Directory.GetFiles("../../txtFiles/");
Console.WriteLine("File Name (date) Count");
Console.WriteLine(".........................");
Console.WriteLine(" ");
foreach (var item in files)
{
using (System.IO.StreamReader file = new System.IO.StreamReader(item)) // Open a text file to update the content
{
var text = file.ReadLine();
if (text.Contains("Send List Count:"))
{
var countArray = text.Split(' ');
var count = countArray[countArray.Length - 1];
var print = item.Replace("../../txtFiles/", "");
print = print.Replace(".txt", "");
print = print + " " + count;
Console.WriteLine(print);
}
}
}
}
Regards,
Selva Ganapathy K