distributed-computing/tasks/plaksina-av/lab_2/worker-1/Program.cs
2023-10-12 02:40:26 +04:00

24 lines
774 B
C#

using System;
using System.IO;
string resultFilePath = "../var/result/data.txt";
using (StreamWriter writer = new StreamWriter(resultFilePath, false))
{
foreach (var file in Directory.GetFiles("/var/data"))
{
using (StreamReader sr = new StreamReader(file))
{
String line;
Int16 i=0;
while ((line = sr.ReadLine()) != null)
{
i++;
}
writer.WriteLine(i.ToString());
Console.WriteLine("Количество строк в файле: " + i.ToString());
}
}
}
Console.WriteLine("Файл первого приложения успешно создан: " + resultFilePath);