I want to create a list of all the files in a directory, except hidden fies and files inside hidden folder in the directory. I used this method,
new DirectoryInfo(path).GetFiles("*.*", SearchOption.AllDirectories)
.Where(f => (f.Attributes & FileAttributes.Hidden) == 0)
But the above method return files inside hidden folders. Are there any other way to do this without recursively iterating through directories?