Get file from specific directory if it match

Hi All,

i want to open excel file from specific directory
eg:

if Directory.Exists("\nn\DD)

  if (CO_244_VAT  = CO_244_VAT )

open the file from DD folder

but in folder 2 types of files with same file name text and excel file but i want to open excel file with .xlsx extension}

additional info : folder contains bunch of files

Can you please let me know how to do this one @ClaytonM @Divyashreem @vvaidya @arivu96

You can use Path.GetExtension method to find extension of files.

1 Like

Hi,

  1. assign DirectoryInfo=new DirectoryInfo(argDocFolderPath)
  2. ExcelList = directoryInfo.GetFiles(“*.xlsx”)
  3. For each file in ExcelList have if condition and check for the name, if it matched then use start process
3 Likes

Hi buddy @Naveen.Ch

Great…

  1. Use a assign activity with variable at left path_collec of array type
  2. In the left side ot the same assign variable enter like…
    Directory.GetFiles(“\nn\Dd”,“*.xlsx”)
    This gives you only xlsx filea
  3. If you want to open the files as @Divyashreem mentioned, use a for each loop with input path_collec and change the type to string
  4. Use start process and pass the input as item from for each loop…
  5. Thats all buddy you are all done

Cheers.

1 Like

Thanks for the quick response
i have tried your solution but its checking only first excel file match or not, if it is not match it is not iterating to check all the files

Regards,
Naveen

can you just try to debug and check how many file names are there in directory info.?

Buddy @Naveen.Ch
hope this workflow could help you buddy

Cheers…Directoryexists.xaml (8.0 KB)

1 Like

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