Hi folks
I have many files in the folder and file name convention is
INGG Total Enrollment_2024_06_02.xlsx
INGG Total Enrollment_2024_06_17.xlsx
I want to get latest date file that is 2024_06_17.xlsx
How I achieve this
Get all files in the desired folder using this code in assign activity. fileList = Directory.GetFiles(folderPath, "INGG Total Enrollment_*.xlsx")
LINQ Query to Get the Latest File. Use in assign activity: Assign latestFile = fileList.OrderByDescending(Function(file) DateTime.ParseExact(System.Text.RegularExpressions.Regex.Match(System.IO.Path.GetFileNameWithoutExtension(file), "\d{4}_\d{2}_\d{2}").Value, "yyyy_MM_dd", System.Globalization.CultureInfo.InvariantCulture)).FirstOrDefault()