I am trying to write a program to output a list of all the files and folders in a drive, and I am wondering what methods people would use to achieve this so I can work out which one is fastest and best for my purposes.

My first attempt, of course, was with the dir() command and I wrote a simple yet effective method of recursive checking (I'm aware dir() doesn't work well with recursive checking, but it doesn't follow a new branch until it has finished in the current folder, and it builds up a list of new folder branches to check) but the problem with using dir() is attributes...if I set it to vbDirectory it lists vbDirectory AND files without any attributes. I am aware that there's a workaround for that where I can do a list of all the files without attributes then of vbDirectory then remove any that are in both lists, but this is a lot of extra work

The code I wrote for the dir() method:

Code:
Private Function getdrive(dr As String) As String
Do
drvinf = Dir(dr, vbDirectory)
Do
If drvinf <> "" Then
Debug.Print drvinf 'Used for testing
    AddDir (dr & drvinf)
    drvinf = Dir(, vbDirectory)
    End If
Loop While drvinf <> ""
curdircheck = curdircheck + 1
dr = dirs(curdircheck)
Loop While curdircheck < dircount

End Function
Private Function AddDir(direc As String) As String
dircount = dircount + 1
dirs(dircount) = direc
End Function
As I said above, the problem there is vbDirectory doesn't list JUST the directories, it adds files without any attributes...any better suggestions or ideas for improvement?