How to get all the files of a directory in creation time order in string array

excel
uiautomation
robot
activities
studio

#1

Hi,

Please help on this

Thanks in advance :slight_smile:


#2

@SwarnaGold
You can use the assign activity and use the expression Directory.GetFiles(@“D:\UiPath”)
The expression returns a list of files in the given directory.


#3

Use this for directory path : Directory.GetFiles(“Directory Path”)
For getting the file creation time : File.GetCreationTime(item.ToString).ToString

Add them into a List and the sort the list accordingly.
For reference : Main.xaml (9.3 KB)


#4

Hi @SwarnaGold

String[] = Directory.GetFiles(“FolderPath”,“FileType”,SearchOption.AllDirectories).OrderByDescending(Function(d) New FileInfo(d).CreationTime)

Use this Expression to get the all the files based on descending order
Hope this will helpful

Regards
JothyPrasanth M


#5

@Rashmi
Thanks I got solution