0

如何在 C# 4.0 中枚举隐藏文件/目录

基本上我用

var directories = new DirectoryInfo(@"DirectoryName")
                .EnumerateDirectories()
                .Where(**What is the condition that should go here?**)
4

1 回答 1

5

使用 FileAttributes.Hidden

var Directories = new DirectoryInfo(@"DirectoryName")
                .EnumerateDirectories()
                .Where(x => x.Attributes.HasFlag(FileAttributes.Hidden))
                .Select(x => x.Name);
于 2013-06-23T18:13:25.133 回答