static void RecursiveReadOnlyList(DirectoryInfo dir)
{
Console.WriteLine("Directory {0}", dir.FullName);
foreach (FileInfo f in dir.GetFiles())
{
if((f.Attributes & FileAttributes.ReadOnly)!=0)
Console.WriteLine("Read Only File: {0}", f.FullName);
}
foreach (DirectoryInfo d in dir.GetDirectories())
{
RecursiveReadOnlyList(d);
}
}
更详细的内容可以参考这篇:
http://jared.tw/wiki/doku.php?id=pl:csharp:recursively_listfiles
http://Jared.TW 梁哲玮的笔记簿