29 lines
680 B
C#
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("Файл успешно сформирован!");
|
|
}
|
|
}
|