Directory.Delete(path, true) raise an exception for non empty directories..

  • Thread starter Thread starter genc ymeri
  • Start date Start date
G

genc ymeri

Hi over there,
What command should I run to delete folders even if theirs subfolders are
not empty with files ?????

Thanks in advance.
 
genc said:
Hi over there,
What command should I run to delete folders even if theirs subfolders are
not empty with files ?????

Thanks in advance.

"subfolders are not empty with files" is not a problem of
"Directory.Delete(..,true)".

"Directory.Delete(..,true)" raises exception if some file/subfolder in
the folder cannot be deleted.

For example,
some files in the folder are marked as readonly,
some file/folder has been opened by other applications,
current user has no permission to delete the files/folders,
etc.

In such case, you shold catch the exception and prompt it to user to handle.
 
Back
Top