String.Join to Get Latest File Error

Hello guys,

I encountered a problem when using String.Join to get the latest file in folder.
There is a space between the file path folder and the file.
“U:\1202IE\DEPT\IE1 Section\Capacity\OFS\2020\ Fab1 OFS 20200731.xlsx”
________________________________________ ^
The code I use is
String.Join(“",Directory.GetFiles(“U:\1202IE\DEPT\IE1 Section\Capacity\OFS\2020”,”*.xlsx",SearchOption.AllDirectories).OrderByDescending(Function(d) New FileInfo(d).CreationTime).Take(1) )

Thanks a lot.

@irene1018b I do not think that should be the case, Can you show the Screenshots of how you have implemented it in the workflow ?

But If you do have a space after 2020, It will take it as well, and then append the Found xlsx file path to it.

Check this below code, @irene1018b
String.Join(“”, System.IO.Directory.GetFiles(“Folder_Path”,“*.xlsx”,SearchOption.AllDirectories).OrderByDescending(Function(d) New FileInfo(d).CreationTime).Take(1) )

Thanks for your reply, however, there is still a space in front of “Fab1” and "2020"

@irene1018b Can you maybe show the Workflow Screenshot ? :sweat_smile: