It is my understanding that you want to list the subdirectories below a given path that contain only files.
static IEnumerable<string> GetSubdirectoriesContainingOnlyFiles(string path)
{
return from subdirectory in Directory.GetDirectories(path, "*", SearchOption.AllDirectories)
where Directory.GetDirectories(subdirectory).Length == 0
select subdirectory;
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…