c# - Merge Files in a directory, with a newline appended each time -


I have a bunch of txt files in a directory, which I want to merge into a file. At the end of each file I want to add a cart / return line.

What is the best way to do this in C #?

One-liner that is significantly worse on memory consumption:

  File. Merge all lines (targetFileName, Directory.GetFiles (srcFolder, "* .txt") .SelectMany (f => File.ReadLines (f) .Concat (new [] {Environment.NewLine})));   

Hope you can stay in the end with additional Newline.

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -