What's Here?
- Members: 340,137
- Replies: 920,471
- Topics: 154,938
- Snippets: 4,855
- Tutorials: 1,257
- Total Online: 3,913
- Members: 136
- Guests: 3,777
|
|
Submitted By:
RodgerB
|
|
Rating:

|
| Views: 3,056 |
Language: VB.NET |
| Last Modified: January 1, 1970 |
Instructions: 1) Copy and paste this subroutine into a class.
2) Read the information on how to call the snippet. |
Snippet
''' <summary>
''' Deletes the contents of a directory.
''' </summary>
''' <param name="dir">Directory to delete the contents of.</param>
Public Sub DeleteDirContents(ByVal dir As IO.DirectoryInfo)
Dim fa() As IO.FileInfo
Dim f As IO.FileInfo
fa = dir.GetFiles
For Each f In fa
f.Delete()
Next
Dim da() As IO.DirectoryInfo
Dim d1 As IO.DirectoryInfo
da = dir.GetDirectories
For Each d1 In da
DeleteDirContents(d1)
Next
End Sub
' To use the subroutine, use this code inside a subroutine.
' "c:\lol" being the path you would like to use.
DeleteDirContents(New IO.DirectoryInfo("c:\lol"))
Copy & Paste
|
|
|
Be Social
Reference Sheets
Bye Bye Ads
Monthly Drawing
Top Contributors
Top 10 Kudos This Month
|