public string GetDirectory() { string directory = null; do { if (directory != null) { inputAdapter.WriteLine("Directory not found. Please enter a valid directory:"); } else { inputAdapter.WriteLine("Please specify a directory: "); } directory = inputAdapter.ReadLine(); } while (!Directory.Exists(directory)); return(directory); }