// Delete all the files in specified directory in asp.net


private void DeleteAllFilesInMyDirectory(string MyDirectoryPath)
{
if (Directory.Exists(HttpContext.Current.Server.MapPath(MyDirectoryPath)))
{
string[] filenames = System.IO.Directory.GetFiles(HttpContext.Current.Server.MapPath(MyDirectoryPath));
foreach (string filename in currntDirectoryFilenames)
{
File.Delete(filename);
}
}
}

Read more: http://feeds.dzone.com/~r/dzone/snippets/~3/KSGYh5pM1cI/14555