CSharp examples for File IO:Directory
Get Files from folder
using System.Collections.Generic; public class Main{ public static List<string> GetFiles(string path, string pattern) {/*from ww w . j a v a 2 s. c o m*/ string[] array = System.IO.Directory.GetFiles(path, pattern); if (array == null || array.Length == 0) return null; List<string> list = new List<string>(); foreach (string item in array) { string[] arr = item.Split('\\'); list.Add(arr[arr.Length - 1]); } return list; } }