
OpenNTF Code Bin
About This Code
Brief Description:
Get Subfolder from a Folder
Contributor:
Bastian Wieczorek
Notes Version:
R6.x, R7.x
Last Modified:
03 Sep 2007
OpenNTF Disclaimer
All of the program code and information presented in the OpenNTF.org Code Bin are provided "as-is", and should be used at your own risk. OpenNTF.org make no express or implied warranty about anything in the Code Bin, and OpenNTF.org will not be responsible or liable for any damage caused by the use or misuse of anything from this site. OpenNTF.org makes no guarantees about anything. Please thoroughly test all of the knowledge and code you find here before you attempt to use them in your production environment.
Code / Description
This code get all the foldernames from a given path.
-----------
Dim pathName As String
pathName = "C:\test"
' ^^^ initialfolder
Dim fileName As String ' The Filename
Dim FolderArray() As Variant ' The Array with all folders
Dim FolderCounter As Long ' The FolderCounter
FolderCounter = 0
Print "FileFunction [Start]---------------------------------------------------"
fileName = Dir$(pathName+"\*.*",16)
Do While fileName <> ""
If Getfileattr(pathName+"\"+fileName) = 16 And Not filename = "." And Not filename = ".." Then
Redim Preserve FolderArray(FolderCounter)
' if we have a folder in the fileName Var. then add it to the array
Print pathName+"\"+fileName
FolderArray(FolderCounter) = pathName+"\"+fileName
FolderCounter = FolderCounter +1
End If
fileName = Dir$()
Loop
Print "FileFunction [Ende]---------------------------------------------------"
Usage / Example
Comments
No documents found