I have a file that has > 10 rows. I want to create 9 files that each contains equal number or rows, with the 10th file containing that equal number plus any left over.
I currently get the data from the main file by the following:
Dim sData As String
Using sr As New StreamReader(vsFilePath)
sData = sr.ReadToEnd
End Using
Dim oDataList As New List(Of String)
oDataList.AddRange(sData.Split(Convert.ToChar(ControlChars.Lf)))
How can I take oDataList and parse it into 10 files without having to loop through each file and oDataList to write line by line?
Is there a better way them what I am currently doing?
If the order of the lines is not important, you can do the following to separate the content in 10 equal portions, otherwise, a double loop through the data (one for counting and storing the lines, the other for writing them) is probably necessary.