distributed-computing/tasks/savitskiy-al/lab_2/worker-1/Program.cs
2023-12-07 00:34:42 +04:00

24 lines
772 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);