Dir() function problem

Tech-Archive recommends: Speed Up your PC by fixing your registry



hi,

I wanted to traverse a complete directory structure
and search for some files to process

I found that I get "Invalid procedure call or argument" (5)
from sCurEntry = Dir$()
when there is a directory like ".settings"

is this a documented feature?
I am using WindowsXP. Does this happen with other versions too.
What is the supposed workaround?

thanks

Peter

Test Code:

Private Sub readDir(ByVal sInitialDir As String)

Dim sCurEntry As String
Dim sFullPath As String

If Not Right$(sInitialDir, 1) = "\" Then
sInitialDir = sInitialDir & "\"
End If

sCurEntry = Dir$(sInitialDir, vbDirectory)

Do Until Len(sCurEntry) = 0

sFullPath = sInitialDir & sCurEntry

If sCurEntry = "." Or sCurEntry = ".." Then
'
ElseIf CBool(GetAttr(sFullPath) And vbDirectory) Then
readDir sFullPath & "\"
Else
'processFile sCurEntry, sFullPath
End If

sCurEntry = Dir$()
Loop

End Sub


Sub Main()
MkDir "D:\Test\
MkDir "D:\Test\.settings\"
readDir "D:\Test\
End Sub
.