-1
In the following code snippet written in C# Asp.net core mvc, the application READ the.txt files and all their contents inside a specific folder, then stores the READ content in a new file (similar to a CONCAT or MERGE string, eg.)
I need to modify this code so that it is able to read 2 text files inside a specific folder and create a new text file with all the contents of the first two files, removing the repetitions.
Entree txt file (a,b,c,d,e,f) Arquivo2.txt (e,f,g,h)
Exit Arquivo3.txt (a,b,c,d,e,f,g,h)
CODE BASE
private static void CombineMultipleFilesIntoSingleFile(string inputDirectoryPath, string inputFileNamePattern, string outputFilePath)
{
string[] inputFilePaths = Directory.GetFiles(inputDirectoryPath, inputFileNamePattern);
Console.WriteLine("Number of files: {0}.", inputFilePaths.Length);
using (var outputStream = File.Create(outputFilePath))
{
foreach (var inputFilePath in inputFilePaths)
{
using (var inputStream = File.OpenRead(inputFilePath))
{
// Buffer size can be passed as the second argument.
inputStream.CopyTo(outputStream);
}
Console.WriteLine("The file {0} has been processed.", inputFilePath);
}
}
}
Please edit the question to limit it to a specific problem with sufficient detail to identify an appropriate answer.
–
the question is already limited.
– Tales Valente