Get Current Day Latest File from Folder

You can use the below to first filter out only files created today, then sort by creation time, and then take the first in the list:

directory.getFiles(“yourfilepath”).where(Function(f) file.GetCreationTime(f).ToShortDateString = today.ToShortDateString).OrderByDescending(function(f) file.GetCreationTime(f)).First

1 Like