private void getDirectories(string path) { string[] fileNames = Directory.GetFiles(path); string[] directories = Directory.GetDirectories(path); foreach (string file in fileNames) { Console.WriteLine( "Filename:{0} ",file); } foreach (string dir in directories) { Console.WriteLine( "Directoriesname:{0} ",dir); getDirectories(dir); } }