var directoryPath = Path.Combine(project.Directory, "TestDirectory");
var imgList = Directory.GetFiles(directoryPath).Where(f => !Path.GetExtension(f).Equals(".jpg")).ToList();
if(imgList.Count > 0)
{
foreach(var filePath in imgList)
{
File.Delete(filePath);
}
}