Select date with format dd.MM.yyyy of newest file in folder

Hi,
i have big problems to understand the LINQ-technology.

How can i determine the date in format “dd.MM.yyyy” of the newest file in a folder with fileinfo “lastwritetime” and store it in a string-variable?

Hi @gerhard.reisinger

Directory.GetFiles("C:\Your\Folder\Path").Select(Function(file) New System.IO.FileInfo(file).LastWriteTime).OrderByDescending(Function(d) d).First().ToString("dd.MM.yyyy")

Regards

1 Like

Perfect solution, thank you very much!

1 Like

but rely on the .Net Classes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.