c# loop directory code example Example: C# cycle through directory foreach(string fileName f in Directory.GetFiles("SomeDirectory")) { ... }