So basically what I'm trying to do is get the date modified of a file that FileInfo gets. Hopefully the code will explain a little better.
DirectoryInfo prefetch = new DirectoryInfo("c:\\Windows\\Prefetch");
FileInfo[] log = prefetch.GetFiles("2*");
if (log.Length == 0)
MessageBox.Show("Nothing Found");
else
DateTime modified = System.IO.File.GetLastWriteTime(Convert.ToString(log));
MessageBox.Show(Convert.ToString(modified));
The above code does not work/do what I want it do. sSo say in Prefetch there is a file called log2.txt. the FileInfo would detect that it is there, but I'm trying to display the Date Modified of that file. I know how to see if it exists and how to show the date modified, but I can't figure out how to retrieve the name of the file/file that FileInfo finds then display the date modified. Any suggestions or answers would be greatly appreciated.
If there is only one file, I believe it would be file[0].LastWriteTime