PDA

Click to See Complete Forum and Search --> : Directory Listing


Crazy D
Jan 4th, 2000, 12:56 AM
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...)

Jan 4th, 2000, 03:50 AM
Silly me!! You'd think I'd have spotted that, wouldn't you!!! Cheers.

------------------
Matthew Ralston
E-Mail: m.ralston@mediavault.co.uk
ICQ:31422892 (http://www.thebluelink.cjb.net/icq.html)
Web Sites:The Blue Link (http://www.thebluelink.cjb.net) My Home Page (http://mralston.cjb.net)

Jan 4th, 2000, 04:45 AM
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: m.ralston@mediavault.co.uk
ICQ:31422892 (http://www.thebluelink.cjb.net/icq.html)
Web Sites:The Blue Link (http://www.thebluelink.cjb.net) My Home Page (http://mralston.cjb.net)

Jan 4th, 2000, 11:26 AM
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?

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: m.ralston@mediavault.co.uk
ICQ:31422892 (http://www.thebluelink.cjb.net/icq.html)
Web Sites:The Blue Link (http://www.thebluelink.cjb.net) My Home Page (http://mralston.cjb.net)