Possible Duplicate:
How to test if directory is hidden in C#?
DirectoryInfo dir = new DirectoryInfo(@"c:\test");
if ((dir.Attributes & FileAttributes.Hidden) == (FileAttributes.Hidden))
{
//do stuff
}
With this if statement i would like to test if the directory is hidden. Although the directory really is hidden, my program doesn't get into the do stuff because only the directory flag of the attributes is set. Any suggestions?
Try this:
DirectoryInfo dir = new DirectoryInfo(@"c:\test");
if ((dir.Attributes & FileAttributes.Hidden) != 0)
{
//do stuff
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With