the 2nd time you use dir(), you don't specify you want only files... (or, alternatively, you don't check if it's a directory before you print it...)
Printable View
the 2nd time you use dir(), you don't specify you want only files... (or, alternatively, you don't check if it's a directory before you print it...)
Silly me!! You'd think I'd have spotted that, wouldn't you!!! Cheers.
------------------
Matthew Ralston
E-Mail: [email protected]
ICQ:31422892
Web Sites:The Blue Link My Home Page
Ok, I've added this bit to the second Dir$ statemets (for the files)...
vbNormal + vbHidden + vbReadOnly + vbSystem + vbArchive
...but it still reports many of the ordinary files as being folders. What's going on?!
------------------
Matthew Ralston
E-Mail: [email protected]
ICQ:31422892
Web Sites:The Blue Link My Home Page
I've got a direcotry listing function that I'm using as part of a Telnet Server I'm making, but when I execute it many items get duplicated and some get reported as both files and folders... Any Ideas why?
------------------Code:Private Sub Dir_List()
Dim sLine As String, iFiles As Integer, iFolders As Integer
debug.print vbCrLf
' Folders
sLine = Dir$("*.*", vbDirectory)
Do Until sLine = ""
debug.print sLine & vbTab & vbTab & vbTab & "<dir>" & vbCrLf
sLine = Dir
iFolders = iFolders + 1
Loop
' Files
sLine = Dir$("*.*")
Do Until sLine = ""
debug.print sLine & vbCrLf
sLine = Dir
iFiles = iFiles + 1
Loop
debug.print "-----------------" & vbCrLf
debug.print iFiles & " file(s), " & iFiles & " folder(s)." & vbCrLf & vbCrLf
End Sub
Matthew Ralston
E-Mail: [email protected]
ICQ:31422892
Web Sites:The Blue Link My Home Page