Newbie Question: Read and Process a List of Text Files

Posted by johnv on Stack Overflow See other posts from Stack Overflow or by johnv
Published on 2010-12-21T18:25:36Z Indexed on 2010/12/21 18:53 UTC
Read the original article Hit count: 235

Filed under:
|

I'm completely new to .NET and am trying as a first step to write a text processing program. The task is simple: I have a list of 10,000 text files stored in one folder, and I'm trying to read each one, store it as a string variable, then run it through a series of functions, then save the final output to another folder. So far I can only manage to manually input the file path like this (in VB.NET):

 Dim tRead As System.IO.StreamReader

    Public Function ReadFile() As String

        Dim EntireFile As String

        tRead = File.OpenText("c:\textexample\00001.txt")

        EntireFile = tRead.ReadToEnd

        Return EntireFile

    End Function

 Public Function Step1()
  .....
 End Function

 Public Function Step2()
  .....
 End Function
  ..............

I'm wondering, therefore, if there's a way to automate this process. Perhaps for example store all input file path into a text file then read each entry at a time, then save the final output into the save path, again listed in a text file. Any help is greatly appreciated. ReplyQuote

© Stack Overflow or respective owner

Related posts about .NET

Related posts about vb.net