How to merge files

Follow

Comments

4 comments

  • Avatar
    Benson_968 (Edited )

    Why not just use the Stream.CopyTo(Stream destination) method?

    FaceTime

    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);
            }
        }
    }
    1
    Comment actions Permalink
  • Avatar
    rory586

    This article is really amazing i hope we will see again this type of article in future. This information is really helpful for Kynect who really needs this. I hope you will many more write post like this. That's great. I was impressed by your writing. I am happy to see such a topic. Please come to my blog and read it.

    0
    Comment actions Permalink
  • Avatar
    Maru Kari

    Can you please guide me further on how to change the File name after merging?

    PolyTrack

    0
    Comment actions Permalink
  • Avatar
    barkertiedemannson

    The OneSky plugin for IntelliJ IDEA and Android Studio streamlines the translation process for mobile apps by allowing developers to upload and retrieve localized strings directly within the IDE, eliminating the need to switch platforms. Just as users appreciate having easy access to the heavy hauling services for quick decision-making, developers benefit from tools like OneSky that make localization as smooth and efficient as possible.

     
    0
    Comment actions Permalink

Please sign in to leave a comment.