I have a folder named A which has subfolders A1, A2 and A3. Each of these subfolders contain a folder named B. I want to seach the subsfolders of A which are A1, A2 and A3 for the B folder and if it exist I want to get from that folder the latest file path.
var directory = new DirectoryInfo(@"C:\app\A\A1\B");
var myFile = directory.GetFiles()
.OrderByDescending(f => f.LastWriteTime)
.First();
I wan to avoid using the directory var and search instead.