I have "C:\IdsLogs" folder , when i execute my certain code , it generates the "Response.txt"
so i have number of Response.txt files , i want to access last Response.txt file , how to read it in string , How to write code for it?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Anuradha ChavanPosted May 13, 2014, 2:48 AM
Abhay ShankerPosted May 13, 2014, 12:32 AM
var openedFiles = from fName in Directory.EnumerateFiles(dir, "*.txt")
orderby File.GetLastAccessTime(fName) descending
select new FileInfo(fName);
if (openedFiles.Any())
{
var lastOpenedFile = openedFiles.First();
}
http://stackoverflow.com/questions/12067733/opening-most-recent-txt-file
VulpesPosted May 12, 2014, 11:13 AM
string text = System.IO.File.ReadAllText(@"C:\IdsLogs\Response.txt");