I test this code and debug on device for the purpose of trying to delete folder:
but it not delete the folder after debug on device although appear message box delete operation success...
any idea?
Code:
using System; using System.IO; class Test { public static void Main() { // Specify the directories you want to manipulate. string path = @"\MyDir"; string subPath = @"\MyDir\temp"; try { // Determine whether the directory exists. if (!Directory.Exists(path)) { // Create the directory. Directory.CreateDirectory(path); } if (!Directory.Exists(subPath)) { // Create the directory. Directory.CreateDirectory(subPath); } // This will succeed because subdirectories are being deleted. MessageBox.Show("I am about to attempt to delete {0}", path); Directory.Delete(path, true); MessageBox.Show("The Delete operation was successful."); } catch (Exception e) { MessageBox.Show("The process failed: {0}", e.ToString()); } finally {} } }
any idea?