|
-
Jun 21st, 2000, 07:00 PM
#1
Thread Starter
Addicted Member
How can I find if a directory is exist in my computer
and how can i find the path to it.
The MORE I get to know,
I realize that I know NOTHING !
-
Jun 21st, 2000, 07:07 PM
#2
Lively Member
Do you mean Does folder "C:\WinNT\System32\Drivers\" exist or Where is folder "Drivers"???
Toot
Some cause happiness wherever they go; others, whenever they go.
-
Jun 21st, 2000, 07:12 PM
#3
Lively Member
This code works great and someone here gave it to me. This code also catches all of the files to, so if don't want that part of it just remove the Filecatch event.
Event Direcatch(dire As String, path As String, level As Integer)
Event Filecatch(File As String, path As String, level As Integer)
Public curlevel As Integer
Public filemax
Public diremax
Public tid
Public Sub explore(startdir As String, Optional pauses = 100)
tids = Timer
filemax = 0: diremax = 0: totalb = 0: curlevel = 0
If Right(startdir, 1) <> "\" Then startdir = startdir & "\"
ListSubDirs startdir, pauses
tid = Timer - tids
End Sub
Sub ListSubDirs(path As String, pauses)
Dim i, dmax, dirname As String, dire() As String 'declare variables
dirname = Dir(path, 63) 'get first directory name
If dirname = "" Then
TrueFalse = False
Else
TrueFalse = True
End If
If dirname = "" Then
'if current directory is already created then don't create again
If TrueFalse = False Then
Exit Sub
Else
MkDir path
End If
End If
Do While dirname <> ""
If dirname <> "." And dirname <> ".." Then
If Int(GetAttr(path + dirname) / 16) Mod 2 = 1 Then
If (dmax Mod 10) = 0 Then
ReDim Preserve dire(dmax + 10) 'resize the array
End If
dirmax = diremax + 1: dmax = dmax + 1
dire(dmax) = dirname
RaiseEvent Direcatch(dirname, path, curlevel)
Else
filemax = filemax + 1
RaiseEvent Filecatch(dirname, path, curlevel)
End If
End If
dirname = Dir 'get antoher directory name
waiter = waiter + 1: If waiter Mod (pauses) = 1 Then DoEvents
Loop
For i = 1 To dmax
curlevel = curlevel + 1
ListSubDirs path & dire(i) & "\", pauses
Next i
curlevel = curlevel - 1
End Sub
Using VB6 Still Pluging away
-
Jun 21st, 2000, 07:14 PM
#4
Lively Member
To get the path you can use Dir(), but I think that the code I gave you above returns the path to.
Using VB6 Still Pluging away
-
Jun 21st, 2000, 11:25 PM
#5
Frenzied Member
Aburke, the code you posted came from KEDAMAN (if you read this: damn, you rule mate, thanks for all the help you gave me!)
and doesn't it has to be placed in a usercontrol?
I really think DIR is the fastest way to find a dir...
have fun.
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
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
|