distributed-computing/tasks/lyamzina-ma/lab_2/worker-1/Program.cs
2023-10-24 21:30:27 +04:00

29 lines
680 B
C#

using System;
using System.IO;
class Program
{
static void Main()
{
string dataDirectory = "/var/data";
string outputFile = "/var/result/data.txt";
string[] fileLines = Directory.GetFiles(dataDirectory);
using (StreamWriter writer = new StreamWriter(outputFile))
{
foreach (string filePath in fileLines)
{
string[] lines = File.ReadAllLines(filePath);
if (lines.Length > 0)
{
writer.WriteLine(lines[0]);
}
}
}
Console.WriteLine("Файл успешно сформирован!");
}
}