【问题标题】:Access the Windows context indexing file attribue using dotnet使用 dotnet 访问 Windows 上下文索引文件属性
【发布时间】:2015-03-14 22:55:09
【问题描述】:

如何以编程方式读取和写入由 Windows“允许此驱动器上的文件除了文件属性之外还有内容索引”对话框设置的文件和文件夹属性?

【问题讨论】:

    标签: c# .net windows indexing file-attributes


    【解决方案1】:

    显然是这样的:

    // read
    var isContentIndexed = ((attributes & FileAttributes.NotContentIndexed) != FileAttributes.NotContentIndexed);
    
    // set
    File.SetAttributes(path, (File.GetAttributes(path) | FileAttributes.NotContentIndexed));
    
    // remove
    File.SetAttributes(path, (File.GetAttributes(path) & ~FileAttributes.NotContentIndexed));
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-01-23
      • 2013-01-05
      • 1970-01-01
      • 2013-05-31
      • 1970-01-01
      • 1970-01-01
      • 2011-12-10
      • 1970-01-01
      相关资源
      最近更新 更多