Hello,
I'm working on trying to find the most recently modified file, but I
keep coming across an error when building.
Here's my code:
DirectoryInfo Direc = new DirectoryInfo(@"U:\xxxx\xxxx");
FileInfo[] FoldersArr = Direc.GetFiles();
if (FoldersArr.Length > 0)
{
DateTime MostRecent = FoldersArr[1].LastWriteTime;
FileInfo RecentFolder;
foreach (FileInfo f in FoldersArr)
{
if (MostRecent.CompareTo(f.LastWriteTime) < 0)
{
MostRecent = f.LastWriteTime;
RecentFolder = f;
}
}
}
MessageBox.Show(RecentFolder.ToString());
Error Message: The type or namespace name 'RecentFolder' could not be
found (are you missing a using directive or an assembly reference?)
Any help would be appreciated as always. Thanks to whoever takes the
time to answer these posts.