31 lines
930 B
C#
31 lines
930 B
C#
using System;
|
|
using System.IO;
|
|
|
|
class Program
|
|
{
|
|
static void Main()
|
|
{
|
|
string inputPath = Environment.GetEnvironmentVariable("DATA_PATH") ?? ".\\data";
|
|
string outputPath = Environment.GetEnvironmentVariable("RESULT_PATH") ?? ".\\result";
|
|
|
|
try
|
|
{
|
|
string[] files = Directory.GetFiles(inputPath);
|
|
|
|
using (StreamWriter writer = new StreamWriter(Path.Combine(outputPath, "data.txt")))
|
|
{
|
|
foreach (string file in files)
|
|
{
|
|
int lineCount = File.ReadAllLines(file).Length;
|
|
writer.WriteLine(lineCount);
|
|
}
|
|
}
|
|
|
|
Console.WriteLine("Файл data.txt успешно создан");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Console.WriteLine("Произошла ошибка: " + ex.Message);
|
|
}
|
|
}
|
|
} |