I have written a function that deletes a file from it's location. The code can be seen as below:
if (File.Exists(strPath + "/FLV/" + flvvideoname))
{
File.Delete(strPath + "/FLV/" + flvvideoname);
}
'strPath' is the path to the directory. When the code get's executed, the file doesn't always get deleted. Running the same code over and over will delete the file. When I troubleshoot this issue, the break point doesn't go past the file delete line and I don't see any errors either. If the break point makes it past the file delete line, that means the file has been deleted properly.
How do I resolve this issue?