If you have the memory, you can read all the lines into an array using
File.ReadLines (string Path)
. Then you can figure the number of lines an move them into new arrays and do a
WriteAllLines(String, String[])
for each file. You can use LINQ to get the lines:
var x = File.ReadLines(@"C:\temp\connections.xml");
File.WriteAllLines(@"C:\temp\connections2.xml", x.Take(10).ToArray());
Use Skip after the first file.