Hi
I am try to delete main folder which contain files and subfolders,using this code
Dim path As String = "C:\Documents and Settings\prasad\Desktop\folder"
If Directory.Exists(path) Then
Directory.Delete(path, True)
Else
Console.WriteLine(path & " not exists")
End If
E.G.in above code folder have files and also subfolder like
C:\Documents and Settings\prasad\Desktop\folder\one.doc
C:\Documents and Settings\prasad\Desktop\folder\foldler2\ddd.docx
C:\Documents and Settings\prasad\Desktop\folder\fol\fff.txt
If i try above vb code i will get this error "The directory is not empty"
So pls reply me how to delete main folder which contains files and subfolder.
Note:Main folder contains files and subfolder,i am dont want like first delete files and then subfolder files and then subfolder form main folder and finally main folder.
I need to delete main folder only,then automatically delete its files and subfolder.like how,if we select and right click the main folder and click delete by mouse.
Regards
Aravind