// 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; namespace E { public class Program { public delegate void Handler(FileInfo fi); public static void Search(string dir, Handler h) { DirectoryInfo d = new DirectoryInfo(dir); FileInfo[] allf = d.GetFiles(); foreach(FileInfo f1 in allf) { h(f1); } DirectoryInfo[] alld = d.GetDirectories(); foreach(DirectoryInfo d1 in alld) { Search(d1.FullName, h); } } public static void Main(string[] args) { Search(@"C:\E", (FileInfo fi) => Console.WriteLine(fi.FullName + " " + fi.Length + " " + fi.LastWriteTime) ); } } }