Hi all, in my case, I have a folder that contains 12 folders (which one represents one company).
In those 12 folders, I have several excel file downloaded from the website.
My task is to open the most recent excel file for each of the folder.
I use ‘for each folder in folder’ activity at the beginning, but I’m lost and don’t know how should I do to get the file in each folder when the folder is in another folder.
Use a for loop to loop through the folders by giving the main folder as Input.
Inside the for loop use the following expresssion Directory.GetFiles().OrderByDescending(function(s) System.IO.file.GetCreationTime(s)).First() to get the latest file. Path will be the for loop item (which is the folder path of each of 12 folders inside main folder)
and also, this is the error detail: [compare.xaml: Compiler error(s) encountered processing expression “CurrentFolder.GetFiles(Str_directoryPath,”*.xlsx").OrderByDescending(Function (p) p.LastWriteTime)(0).FullName".(2) : error BC30518: Overload resolution failed because no accessible ‘GetFiles’ can be called with these arguments:
‘Public Overloads Function GetFiles(searchPattern As String, searchOption As SearchOption) As FileInfo()’: Option Strict On disallows implicit conversions from ‘String’ to ‘SearchOption’.
‘Public Overloads Function GetFiles(searchPattern As String, enumerationOptions As EnumerationOptions) As FileInfo()’: Value of type ‘String’ cannot be converted to ‘EnumerationOptions’.]