Directory Parsing
-
Hello i'm having a problem with the following code fragment: //---------------------------------------------------------------------- //loop through each sub directory in the current dir //and look for each folders contained in folders array foreach(DirectoryInfo subDir in dirs) { //this line eliminates an IO error, although I dont know why it is an error if (subDir.ToString().Equals("System Volume Information")) Console.WriteLine(); else { for (int i =0; i < 7; i++) { currentFolder = folders[i]; if (subDir.Exists)//make sure directory exists { subDir.GetDirectories("*" + currentFolder + "*"); Console.WriteLine(subDir.ToString()); subDir.Equals(null); } //end if } //end for }//end else }//end foreach //recursive statements DirectoryInfo[] subDirs = dirInfo.GetDirectories(); for (int i = 0; i < subDirs.Length; i++) { String dirName = subDirs[i].FullName.ToString(); findFolders(dirName); } }//end method //--------------------------------------------------------------------- Basically it should search the directory hierarchy and ouput to the console the names of the directories that match search criteria contained in the array []folders. Problem is it returns the entire directory hierarchy!! CAN ANYONE HELP ME!!!!