Tuesday, August 20, 2013

Merge multi files into single file.

Code below will merge the multiple files into single file. This will work in C# 4.0 framework on wards. tempFiles is the string , holding the filepath+name of the files . Between each files a separator',' is present. 

            string[] split = tempFiles.Split(',');
            string export_file = "MergedFiles.txt";
            File.WriteAllLines(filePath + export_file, split.SelectMany(File.ReadLines));

No comments:

Post a Comment

Code Formater

Paste Here Your Source Code
Source Code Formatting Options
1) Convert Tab into Space :
2) Need Line Code Numbering :
3) Remove blank lines :
4) Embeded styles / Stylesheet :
5) Code Block Width :
6) Code Block Height :
7) Alternative Background :
Copy Formatted Source Code
 
Preview Of Formatted Code