Do more with
System.IO.DirectoryInfo targetDir = new System.IO.DirectoryInfo(@"C:\some\dir");
System.IO.FileInfo[] pstFiles = targetDir.GetFiles("PST*");
System.IO.FileInfo[] seqFiles = targetDir.GetFiles("SEQ*");
foreach (System.IO.FileInfo seq in seqFiles)
{
string name = seq.Name.ToLower();
bool found = false;
foreach (System.IO.FileInfo pst in pstFiles)
{
string tempName = string.Concat("seq", pst.Name.Substring(3).ToLower());
if (name == tempName)
{
found = true;
break;
}
}
if (!found)
{
seq.Delete();
}
}
Premium Content
You need an Expert Office subscription to comment.Start Free Trial