Handling hidden files in For Each file in Directory?

I’m trying to create a task that goes through a folder of .docx files, reads and parses needed information out of it, and moves the file to another location. The problem I’m facing is that it’s reading about 20 docx files with “~” attached to the file name that are hidden in the folder that I want to ignore. I can work around the problem by adding a conditional that checks for the “~”, but I was wondering if there was a more elegant/simpler way to have UIPath ignore the hidden files? Mostly for if/when I run into this problem again.

Did you find any solution for this ? Facing same issue

Try getting the files this way:

directory.GetFiles(“folder_path”).Except(directory.GetFiles(“folder_path”,“~*”)).ToArray

Hope it heps!