C#判断目录是否为隐藏

Posted Dean Feng

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了C#判断目录是否为隐藏相关的知识,希望对你有一定的参考价值。

判断方法:

DirectoryInfo di = new DirectoryInfo(path);
if ((di.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden)
          //为隐藏的

同理可以判断目录是否为只读(ReadOnly)或者系统(System)等其他属性。

以上是关于C#判断目录是否为隐藏的主要内容,如果未能解决你的问题,请参考以下文章