MSDN listing for recursive file search is incorrect.

The MSDN listing for how to recursively search files is incorrect. Their code (in C#, but it applies to all languages) is below. [This is for Directory.GetDirectories and Directory.GetFiles method only] void DirSearch(string sDir) { try { foreach (string d in Directory.GetDirectories(sDir)) { foreach (string f in Directory.GetFiles(d, txtFile.Text)) { lstFilesFound.Items.Add(f); } DirSearch(d); } } catch (System.Exception excpt) { Console.WriteLine(excpt.Message); } } The problem with this code may not be obvious, but if you look careful it takes in a directory, looks in that directory for sub-directories and then spits out the files in each sub-directory. It completely skips all […]