I am getting into some difficulty with a path iterator.
I am looping through directories and know that there are some files / directories that my AD account does not have access to.
In this instance I want to skip over the file I don't have access to and carry on with the loop.
Here is the code
Dimpath As String="C:\Reports\"
Try If Directory.Exists(path) Then For Each name As String In Directory.GetDirectories(path)'Throwing exception here as ntfs does not allow me access to particular dir
children.Add(name)Next name End If Catch ex As Exception
'I want to jump back into the loop and carry on on the next directory if I don't have accessEnd TryWednesday, February 11, 2009 9:26 AM
Are you talking about file access denied or directory access denied, Are you getting error in GetDirectories?
Sorry but could not figure out
"In this instance I want to skip over the file I don't have access to and carry on with the loop"
Arjun PaudelWednesday, February 11, 2009 6:17 PM
If calling Directory.GetDirectories(path) throws an exception, that means you're not getting any of the sub-directory names at all.
So it will be meaningless to "jump back into the loop" because the loop never starts.
Could you provide more information on the exception like its message and call stack so we can get a better idea what's going on?
This posting is provided "AS IS" with no warranties, and confers no rights.Thursday, February 12, 2009 11:34 AM