I am writing a software tool that, as part of its main task, is to search for a directory and its auxiliary directories for a directory with a given name and save each path to a file that ends with the specified directory name in a string array, For example:
level_1 level_2 Level_3
RootDirectory ---> folderA ---> folderD ---> FolderF ---> Target
| | ---> folderE ---> Target
|
| ---> folderB ---> Target
|
| ---> FolderC ---> Target
should pump out:
string[] = {RootDirectory\folderA\FolderD\folderF\Target,
RootDirectory\folderA\folderE\Target,
Rootdirectory\folderB\Target,
RootDirectory\foderC\Target}
I originally used getDirectories(myPath, "Target", SearchOption.AllDirectories)catalog information for the object, but there was a problem. For some reason, it will find the target under folders b and c, as well as in folder A> folderD> folderF, but will skip FolderE. When he finds the first entry in the subdirectory folderA, he will move to the next folder at level_1. I should mention that folderD in my real case is actually sorted alphabetically before folderE, as in this example
so instead, I decided to use IEnumeratorand run the where filter to select files that end with the name of this directory. It found them all. However, I cannot figure out how to do something like getDirectories().Where(x=>(x.attributes & fileattributes.hidden)==0);on IEnumerator.
The problem is that I need to skip hidden SVN directories, because it slows down the process significantly.
, :
, , ?