I'd like to use Directory.EnumerateFiles to show all the files and folders including the ones that are hidden. It's bringing back all the files and folders now but it's not including the hidden ones. My first question is can it retrieve hidden files and if so how. I'm sure that there is a hidden file as i've created one.
I'm using a for loop to loop through the files. It looks like this
For Each mFile In Directory.EnumerateFiles("g:\trash\test"
, "*", New IO.EnumerationOptions
With {
.IgnoreInaccessible = True
, .RecurseSubdirectories = True
, .ReturnSpecialDirectories = True})
I've seen info on how to exclude the hidden files so i'd guess that they are included by default. I'll move on to trying something else if i'm barking up the wrong tree.
thank you
As mentioned already by @Richard, full code below:
For Each mFile In Directory.EnumerateFiles("g:\trash\test", "*",
New IO.EnumerationOptions With {
.IgnoreInaccessible = True,
.RecurseSubdirectories = True,
.ReturnSpecialDirectories = True,
.AttributesToSkip = IO.FileAttributes.None ' This make sure no hidden files or folders are skipped
})
' Your code
Next
EDIT: Works with .NET Framework.