How to sort directory files using last modified date and name

Dear All, I’ve a requirement to sort the files which are in directory using files’ last modified date as one list and sorting files using file names as another list. I tried to use GetFiels.OrderBy( function(x) x.ModifiedDate) but i’m getting error. Kindly help me in this case.

1 Like

Hey @Old_Musical_Hits

Please try this:

folder_path = “D:\TestExcel” //
dir_info = new DirectoryInfo(folder_path)

dir_info.GetFiles().OrderByDescending(Function(x) x.LastWriteTime)

For further assistance please review this attached workflow and let me know :slight_smile:

Sort_Dir_files_last_modified.xaml (6.9 KB)

Regards…!!
Aksh

8 Likes

I have difficulties with this when accessing a network location drive. Anyone experience with this?

Cheers,
Robert

1 Like