DAS_2024_1/kuzarin_maxim_lab_2/FirstApplication/Program.cs

18 lines
689 B
C#
Raw Permalink Normal View History

Console.WriteLine("Запущен первый сервис");
string inputPath = Environment.GetEnvironmentVariable("INPUT_PATH") ?? "./input1";
string outputPath = Environment.GetEnvironmentVariable("OUTPUT_PATH") ?? "./output1";
if (!Directory.Exists(inputPath))
Directory.CreateDirectory(inputPath);
if (!Directory.Exists(outputPath))
Directory.CreateDirectory(outputPath);
var file = new DirectoryInfo(inputPath).EnumerateFiles().Aggregate((x, y) => x.Length > y.Length ? x : y);
var outputFilePath = Path.Combine(outputPath, "data.txt");
if(File.Exists(outputFilePath))
File.Delete(outputFilePath);
File.Move(file.FullName, Path.Combine(outputPath, "data.txt"));