ASP.NET and C# sample Code:
//Sample code to delete PDF files
static void DeletePDFFiles()
{
string strPath = “<Pathe of the directory>”;
DirectoryInfo dir = new DirectoryInfo(strPath);
foreach (FileInfo flInfo in dir.GetFiles())
{
String strExtenstion = Path.GetExtension(flInfo.Name);
if (strExtenstion.ToLower().Equals(".pdf"))
{
flInfo.Delete();
}
}
}
No comments:
Post a Comment