I have a path and I want to list the subdirectories under it, where each subdirectory doesn\'t contain any other directory. (Only those subdirectories which don\'t contain f
It is my understanding that you want to list the subdirectories below a given path that contain only files.
static IEnumerable GetSubdirectoriesContainingOnlyFiles(string path)
{
return from subdirectory in Directory.GetDirectories(path, "*", SearchOption.AllDirectories)
where Directory.GetDirectories(subdirectory).Length == 0
select subdirectory;
}