hi i have a few folders created by my application and id like that when they click a button named "clean up" that it would check to see if any of the predetermined folders exist, if they do then delete them, this is what i have tried so far whats wrong with it?
string tempFolder = Environment.GerFolderPath(Environment.SpecialFolder.ApplicationData);
if (Directory.Exists(tempFolder + "//" + "temp1"))
if (Directory.Exists(tempFolder + "//" + "temp2"))
if (Directory.Exists(tempFolder + "//" + "temp3"))
if (Directory.Exists(tempFolder + "//" + "temp4"))
{
System.IO.Directory.Delete(tempFolder + "\\" + "temp1", true);
System.IO.Directory.Delete(tempFolder + "\\" + "temp2", true);
System.IO.Directory.Delete(tempFolder + "\\" + "temp3", true);
System.IO.Directory.Delete(tempFolder + "\\" + "temp4", true);
}
else
{
MessageBox.Show("No Cleanup Needed");
}
so whats wrong? i tested it and it seemed to with 2 folder but not 4 or more