You can use System.IO.Directory.GetFiles()
to a list of the files, in string[] format.
Then you can use System.IO.File.ReadAllText()
to read complete files, or if they are very big, open a TextReader with System.IO.File.OpenText()
.
If you are looking for a literal keyword, String.Contains()
is all you need.
Deleting a file can be done with System.IO.File.Delete()
. Make sure the file is closed again.
Edit, 2 examples of GetFiles()
:
string[] fileNames = System.IO.Directory.GetFiles(@"C:\");
string[] fileNames = System.IO.Directory.GetFiles(@"C:\", @"*.sys");