search in files

  • Thread starter Thread starter juli jul
  • Start date Start date
J

juli jul

Hello,
How exactly can I open a directory and search in all text files in it
,for a specific string?
Thank you very much!
 
juli jul said:
How exactly can I open a directory and search in all text files in it
,for a specific string?
Thank you very much!

Use Directory.GetFiles to get the files in the directory. Use a
StreamReader to read each file in turn, searching for the string.

If you get stuck, please give more detail of exactly where.
 
Thanks.How can I open a dialog which will allow me to choose directory?
Do I have to read all the files for that purpose? Isn't there any other
option to seek inside them (some File method)?
Thank you
 
juli said:
Thanks.How can I open a dialog which will allow me to choose directory?
Do I have to read all the files for that purpose? Isn't there any other
option to seek inside them (some File method)?
Thank you

You can select the directory using a FolderBrowserDialog for more
information on it see:
http://msdn.microsoft.com/library/d...ifolderbrowserdialogcomponentwindowsforms.asp


And if there was such a method it would do the same thing. You need to
open the file some way.
 
Back
Top