Hi,
I need to get all files from folders for example I have three folders and files inside each. I have to get all files from all folders and then get the one that is the newest so I can later compare the date with another file.
Hi,
I need to get all files from folders for example I have three folders and files inside each. I have to get all files from all folders and then get the one that is the newest so I can later compare the date with another file.
Hi @markosc
What is the criteria for latest?
Modified Time or Creation Time
Creation time
Try this
Directory.GetFiles("C:\TestFolder","*",SearchOption.AllDirectories).OrderBy(Function (x) Directory.GetCreationTime(x)).Last
Give the path of main folder inside which are the subfolders.
But I said I have more then one folder for example:
Then I have to get files from both folders and then from the file list get the latest created one.
Please see the updated post
Directory.GetFiles("C:\TestFolder","*",SearchOption.AllDirectories).OrderBy(Function (x) Directory.GetCreationTime(x)).Last
Give the path of main folder inside which are the subfolders.
Thank you!
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.