' Display the names in C:\ that represent directories.
MyPath = "c:\" ' Set the path.
MyName = Dir(MyPath, vbDirectory) ' Retrieve the first entry.
Do While MyName <> "" ' Start the loop.
' Use bitwise comparison to make sure MyName is a directory.
If (GetAttr(MyPath & MyName) And vbDirectory) = vbDirectory Then
' Display entry only if it a directory.
MsgBox(MyName)
End If
MyName = Dir() ' Get next entry.
Loop
I am looking at the code above. I specifically don’t understand what "MyName = Dir ()" does. It is commented that he gets the next record, but I don’t understand how she gets the next record - in particular, what does Dir () do?
source
share