harmmeijer
Programmer
I want all the directory names from c: (or any other location).
All the subdirectorys of these directorys need to be included.
In perl you can do something like the script below (function calling itselfe everytime a directory is encountered) but in access it does not work.
Is there something I can do because now I ame writing to a batchfile, running the batchfile and printing the output to a textfile and then import the textfile. I want to do this with the dir command.
Here is the code which I made and does not work
Public Function eentest(mypath As String)
' mypath has to be given when calling the function
' it has to end with the \ sign
If mypath <> "" Then
myname = Dir(mypath, vbDirectory)
Do While myname <> "" ' Start the loop.
' Ignore the current directory and the encompassing directory.
If myname <> "." And myname <> ".." Then
' Use bitwise comparison to make sure MyName is a directory.
If (GetAttr(mypath & myname) And vbDirectory) = vbDirectory Then
eentest (mypath & myname & "\"
Debug.Print myname
End If ' it represents a directory.
End If
myname = Dir ' Get next entry.
Loop
End If
End Function
All the subdirectorys of these directorys need to be included.
In perl you can do something like the script below (function calling itselfe everytime a directory is encountered) but in access it does not work.
Is there something I can do because now I ame writing to a batchfile, running the batchfile and printing the output to a textfile and then import the textfile. I want to do this with the dir command.
Here is the code which I made and does not work
Public Function eentest(mypath As String)
' mypath has to be given when calling the function
' it has to end with the \ sign
If mypath <> "" Then
myname = Dir(mypath, vbDirectory)
Do While myname <> "" ' Start the loop.
' Ignore the current directory and the encompassing directory.
If myname <> "." And myname <> ".." Then
' Use bitwise comparison to make sure MyName is a directory.
If (GetAttr(mypath & myname) And vbDirectory) = vbDirectory Then
eentest (mypath & myname & "\"
Debug.Print myname
End If ' it represents a directory.
End If
myname = Dir ' Get next entry.
Loop
End If
End Function