string[] filePaths = Directory.GetFiles(@"c:\Directory\"); foreach (string filePath in filePaths) File.Delete(filePath);
string[] filePaths = Directory.GetFiles(@"c:\Directory\", "*.txt"); foreach (string filePath in filePaths) { File.Delete(filePath); }
string[] Arr = null; Arr = Directory.GetFiles("D:\\Your Directory"); foreach (string item in Arr) { if (item.Substring(item.LastIndexOf("."), item.Length - item.LastIndexOf(".")) == ".txt") { File.Delete(item); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)