There are many .bmp files in my C: \ TEMP directory.
I use the following code to delete the entire .bmp file in my C: \ TEMP directory, but somehow it does not work as I expect. Can someone help me with this?
string[] filePaths = Directory.GetFiles(@"c:\TEMP\");
foreach (string filePath in filePaths)
{
if (filePath.Contains(".bmp"))
File.Delete(filePath);
}
I have already verified that the .bmp file and directory do not have a read-only attribute
Hiren source
share