distributed-computing/tasks/plaksina-av/lab_2/worker-1/Program.cs

24 lines
772 B
C#
Raw Normal View History

2023-10-12 02:40:26 +04:00
using System;
using System.IO;
string resultFilePath = "/var/result/data.txt";
2023-10-12 02:40:26 +04:00
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);