Try this code may help u .
void deleteFiles()
{
DirectoryInfo objDir = new DirectoryInfo(@"D:\");
FileInfo[] objFileList = objDir.GetFiles();
foreach(FileInfo f in objFileList)
{
if (f != null)
if (f.Name.Split('_').Length > 3)
{
f.Delete();
}
}
});
void deleteFiles()
{
DirectoryInfo objDir = new DirectoryInfo(@"D:\");
FileInfo[] objFileList = objDir.GetFiles();
foreach(FileInfo f in objFileList)
{
if (f != null)
if (f.Name.Split('_').Length > 3)
{
f.Delete();
}
}
});
No comments:
Post a Comment