|
-
Nov 19th, 2000, 03:35 AM
#1
Thread Starter
Lively Member
Hey guys,
I'm trying to find ONLY the directories with the Dir() function, i've just found out that specifying vbDirectory returns directories AS WELL AS unattributed files.. does anyone know any way i can return directories only? or even verify whether what the dir function returns is a dir or a file?
Daniel Rose
VB 5.0 Enterprise.
irc:irc2.dynam.ac
If TheCodeInTheSig() Is Not Lame() Then IDontKnowWhatIs()
-
Nov 19th, 2000, 05:08 AM
#2
Thread Starter
Lively Member
Bumps it to the top of the list
c'mon guys someone has to know something
Daniel Rose
VB 5.0 Enterprise.
irc:irc2.dynam.ac
If TheCodeInTheSig() Is Not Lame() Then IDontKnowWhatIs()
-
Nov 19th, 2000, 05:57 AM
#3
Addicted Member
Please try this:
Code:
-------------------------------------------------------
Option Explicit
Dim strDir() As String
Dim strTmp As String
Dim i As Integer
Private Sub Form_Load()
ReDim strDir(i)
strTmp = Dir("c:\*.*", vbDirectory)
Do Until strTmp = ""
If FileLen("c:\" & strTmp) = 0 Then
strDir(i) = strTmp
i = i + 1
ReDim Preserve strDir(i)
End If
strTmp = Dir
Loop
For i = 0 To UBound(strDir)
Debug.Print strDir(i)
Next
End Sub
------------------------------------------------------
VB 6 Professional
-
Nov 19th, 2000, 06:00 AM
#4
Hyperactive Member
Code:
Private Sub Command1_Click()
Dim X As String
Const Pth = "C:\"
X = Dir(Pth, vbDirectory)
While X <> ""
If (GetAttr(Pth & X) And vbDirectory) = vbDirectory Then
List1.AddItem X
End If
X = Dir()
Wend
End Sub
This should work.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|