runnindave
New member
- Joined
- Jul 31, 2007
- Messages
- 1
- Programming Experience
- Beginner
Hey, my first post.
New to VB.net and loving it so far. My issue is that I have a simple app that looks at all directories on a server and reports information on each file in each directory.
The problem is some servers have defective directories that cause the following code to throw a "DirectoryNotFoundException"
When I use a TRY- CATCH - END TRY I can capture the error.
What I need to do is if this defective directory pops up then somehow delete it or simply move on to the next directory.
I used a ON ERROR RESUME NEXT and it will not move on to the next directory and finish the code.
Thanks for any help
Dave
New to VB.net and loving it so far. My issue is that I have a simple app that looks at all directories on a server and reports information on each file in each directory.
The problem is some servers have defective directories that cause the following code to throw a "DirectoryNotFoundException"
VB.NET:
'-----------------------get all files from path
Dim Directory As New IO.DirectoryInfo("" & dirPath & "")
Dim allFiles As IO.FileInfo() = Directory.GetFiles("*.*", IO.SearchOption.AllDirectories)
Dim singleFile As IO.FileInfo
When I use a TRY- CATCH - END TRY I can capture the error.
What I need to do is if this defective directory pops up then somehow delete it or simply move on to the next directory.
I used a ON ERROR RESUME NEXT and it will not move on to the next directory and finish the code.
Thanks for any help
Dave