Question

I tried to run the following code:

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

I got the following result:

$Recycle.Bin: Hidden, System, Directory
ATI: Directory
Documents and Settings: Hidden, System, Directory, ReparsePoint, NotContentIndexed
MSOCache: ReadOnly, Hidden, Directory, NotContentIndexed
PerfLogs: Directory
Program Files: ReadOnly, Directory
Program Files (x86): 65553
ProgramData: 73746
Recovery: Hidden, System, Directory, NotContentIndexed
System Volume Information: Hidden, System, Directory
Users: ReadOnly, Directory
Windows: 65552
hiberfil.sys: Hidden, System, Archive, NotContentIndexed
pagefile.sys: Hidden, System, Archive

Most of those are pretty obvious. But what does those marked in bold mean? Especially the numeric ones for Program Files and Windows.

Was it helpful?

Solution

The attributes of FileSystemInfo are taken from FileAttributes, which is an enumeration.

  • The numbers correspond to the sum of adding the various bits together.

  • ReparsePoint means that there's a reparse point on this directory, which causes NTFS to look at some special data that's been stored along with the directory. You can read more about how they work here.

  • NotContentIndexed means that if there's a content-indexing service running, it won't look at this directory.

OTHER TIPS

I think, this is a sum of attributes from this list

For example,

65552 = 65536 (FILE_ATTRIBUTE_VIRTUAL) + 16 (FILE_ATTRIBUTE_DIRECTORY)

and so on.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top