With regard to the
System.IO.Directory.Delete
and
FileSystem.DeleteDirectory
method, there is quite an important difference.
Using
System.IO.Directory.Delete
a 'System.IO.IOException' will be thrown if the directory isn't empty. However, with
FileSystem.DeleteDirectory
the default action is to go ahead and delete the file unless you include an addidional parameter
This is from this page
Public Shared Sub DeleteDirectory ( directory As String, onDirectoryNotEmpty As DeleteDirectoryOption
)
Parameters directory
Type: System.String Directory to be deleted.
onDirectoryNotEmpty
Type:
Microsoft.VisualBasic.FileIO.DeleteDirectoryOption
Specifies what should be done when a directory that is to be deleted contains files or directories. Default is DeleteDirectoryOption.DeleteAllContents.
The other option is to specify DeleteDirectoryOption.ThrowIfDirectoryNonEmpty
There are also other differences, but this one, to me stands out a mile.