Get directory1

Hi all,
I have to read a CSV file which name is Temp31-10-2023 16_28_54.
The date and time keeps changing everything.

So how to read that file.

Thanks in advance

1 Like

@hanviprebday

if it is in same folder and that is the latest file then you can use the below to get the file details

  1. For each file in Folder activity with folder path and filter as “Temp*.csv”
  2. Use orderby Creation date and break inside the loop…so that after first file it breaks

or use linq as below

requiredfilePath = String.Join("",Directory.GetFiles("FolderPath","Temp*.csv").OrderByDescending(function(x) New FileInfo(d).CreationTime).Take(1))

or

requiredfilePath = Directory.GetFiles("FolderPath","Temp*.csv").OrderByDescending(function(x) New FileInfo(d).CreationTime)(0)

cheers

Try with expression in a assign activity like this

Str_filepath = Directory.GetFiles("C:\YourFolderPath", "Temp*.csv")
    .OrderByDescending(Function(f) New FileInfo(f).LastWriteTime)
    .First()

This will give that filepath of that file which you can use in READ CSV FILE activity

Hope this helps

Cheers @hanviprebday

Thank you all its working

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.