Remove a Directory and its contents.
-
I’m currently using
IO.Directory.Delete(folderToDelete)
to remove a folder. The problem is that it will not delete a folder that contains other folders and/or files. Does anybody now how to remove a folder even if it has sub folders and/or files? Could I useIO.Directory.Move(folderPathToDelete,"")
or is that 'bad practice'? Thank Brad -
I’m currently using
IO.Directory.Delete(folderToDelete)
to remove a folder. The problem is that it will not delete a folder that contains other folders and/or files. Does anybody now how to remove a folder even if it has sub folders and/or files? Could I useIO.Directory.Move(folderPathToDelete,"")
or is that 'bad practice'? Thank BradMSDN: Deletes the specified directory and, if indicated, any subdirectories in the directory. [Visual Basic] Overloads Public Shared Sub Delete(String, Boolean) Directory.Delete(folderToDelete, True) http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemiodirectoryclassdeletetopic.asp[^]
-
MSDN: Deletes the specified directory and, if indicated, any subdirectories in the directory. [Visual Basic] Overloads Public Shared Sub Delete(String, Boolean) Directory.Delete(folderToDelete, True) http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemiodirectoryclassdeletetopic.asp[^]
Thanks.