Can anyone help me with this Read Range problem?

I have only 2 documents in my folder directory, but I don’t know why I use GetFiles() method,then it will read out 3 files and then cause Read Range: file contains corrupt data.
image
:sob:

Hi,

~$ means temporary file.
Can you try the following expression? This returns files except starting with “~$”

files = System.IO.Directory.GetFiles(yourPath).Where(Function(f) not System.IO.Path.GetFileName(f).StartsWith("~$")).ToArray()

Regards,

:grinning: thank you , bro. But I just want to get the xlsx file , how do I filter other File expansion name that are not xlsx?

Hi,

We can use 2nd argument of GetFiles method as the following. Can you try this?

System.IO.Directory.GetFiles(yourPath,"*.xlsx").Where(Function(f) not System.IO.Path.GetFileName(f).StartsWith("~$")).ToArray()

Regards,

you’re great UiPath master ! Thank you so much!

1 Like

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