deepti gupta

deepti gupta

  • NA
  • 33
  • 0

DirectoryNotFound exception on deleting folder using WPF

Sep 12 2014 2:09 AM
Deleting directory using WPF code , sometimes i m getting DirectoryNotFoundexception error. 


if (Directory.Exists(folderpath))
                {
                    DirectoryInfo directory = new DirectoryInfo(folderpath);
                   
                    directory.GetFiles("*", SearchOption.AllDirectories).ToList().ForEach(file => file.Delete());
                }

Answers (4)