CSharp examples for File IO:Directory
Find Files That Match a Wildcard Expression
using System;// w ww . j a v a 2 s. co m using System.IO; static class MainClass { static void Main(string[] args) { DirectoryInfo dir = new DirectoryInfo("c:/a/"); FileInfo[] files = dir.GetFiles("*.cs"); foreach (FileInfo file in files) { Console.Write("Name: " + file.Name + " "); Console.WriteLine("Size: " + file.Length.ToString()); } } }