How to recursively list all the files in a directory and child directories in C#?
This article covers all you need. Except as opposed to searching the files and comparing names, just print out the names.
It can be modified like so:
static void DirSearch(string sDir) { try { foreach (string d in Directory.GetDirectories(sDir)) { foreach (string f in Directory.GetFiles(d)) { Console.WriteLine(f); } DirSearch(d); } } catch (System.Exception excpt) { Console.WriteLine(excpt.Message); } }