【问题标题】:Unknown FileAttributes未知的文件属性
【发布时间】:2009-12-28 15:01:25
【问题描述】:

我尝试运行以下代码:

var top = new DirectoryInfo("C:\\");
foreach(var info in top.GetFileSystemInfos())
    System.Console.WriteLine("{0}: {1}", info.Name, info.Attributes);

我得到了以下结果:

$Recycle.Bin:隐藏、系统、目录
ATI:目录
文档和设置:隐藏、系统、目录、ReparsePointNotContentIndexed
MSOCache:只读、隐藏、目录、NotContentIndexed
PerfLogs:目录
程序文件:只读、目录
程序文件 (x86):65553
程序数据:73746
恢复:隐藏、系统、目录、NotContentIndexed
系统卷信息:隐藏、系统、目录
用户:只读、目录
窗户:65552
hiberfil.sys:隐藏、系统、存档、NotContentIndexed
pagefile.sys:隐藏、系统、存档

其中大部分都很明显。但是那些以粗体标记的是什么意思?尤其是用于 Program Files 和 Windows 的数字。

【问题讨论】:

    标签: windows file-attributes


    【解决方案1】:

    我想,这是this list的属性总和

    例如,

    65552 = 65536 (FILE_ATTRIBUTE_VIRTUAL) + 16 (FILE_ATTRIBUTE_DIRECTORY)
    

    等等。

    【讨论】:

      【解决方案2】:

      FileSystemInfo的属性取自FileAttributes,是一个枚举。

      • 数字对应于各个位相加的总和。

      • ReparsePoint 表示此目录上有一个重新分析点,这会导致 NTFS 查看与该目录一起存储的一些特殊数据。您可以详细了解它们的工作原理here

      • NotContentIndexed 表示如果有内容索引服务正在运行,它不会查看此目录。

      【讨论】:

        猜你喜欢
        • 2018-09-07
        • 2022-01-21
        • 1970-01-01
        • 2023-01-04
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-02-07
        • 2019-03-22
        相关资源
        最近更新 更多