Directory.GetFiles(myPath,"*.xlsx",SearchOption.AllDirectories) reads non-existing files

Hello I’m using the below to read all excel files in a directory (subfolders involved) and loop each one through, I use a write cell activity to write the file path in excel and I’m getting a file that does not exist any where in that directory with a ~ at the beginning of the file name.
~$03-205-207 IC Debt JE WB - Microgrid.xlsx does not exist in that directory whatsoever.

Does anyone know how to fix this?

thanks!

Hi,

Can you try the following expression?

Directory.GetFiles(myPath,"*.xlsx",SearchOption.AllDirectories).Where(Function(s) not System.IO.Path.GetFileName(s).StartsWith("~"))

Regards,

@Yoichi you are awesome! works perfectly!! thank you so much for helping me again and again!

1 Like

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