How can I programmatically read and write the file and folder attribute which is set by the Windows "Allow files on this drive to have contents indexed in addition to file properties" dialog?
Asked
Active
Viewed 507 times
1 Answers
2
Like this apparently:
// 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));

stovroz
- 6,835
- 2
- 48
- 59