How to sort directory files using last modified date and name

file

#1

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.


#2

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


Sort file and store attributes
@retrieve each file in directory last modified
Open file in directory
Open file in directory
#3

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

Cheers,
Robert