// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.IO; public class MainClass { public static void Find(string dir, String fnm) { string[] files = Directory.GetFiles(dir); foreach(string f in files) { if(Path.Combine(dir, fnm) == f) { Console.WriteLine(dir); return; } } string[] dirs = Directory.GetDirectories(dir); foreach(string d in dirs) { if(d != @"C:\System Volume Information") { Find(d, fnm); } } } public static void Main(string[] args) { Find(@"C:\", "dir.cs"); Find(@"C:\", "dir2.cs"); Find(@"C:\", "build.bat"); } }