I have create a program that delete a folder. Like this :
if (Directory.Exists((System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "My Dir Name"))))
{
Directory.Delete(System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "My Dir Name"), true);
}
this is alright . But a file that name is "Delete.exe" is in directory of "My Dir Name" [Like my code ] ! It gave an error, because "Delete.exe" is running and can't delete .
What can I do to delete, "Delete.exe"?