Use the file systems object to loop through the folders and sub folders. There may be a more efficent way to do this, any input would be appreciated
<%
Public Function GetFolderList(strPathName)
'Returns comma delimited string of folder names
' starting with "l2d" starting at the strPathName
' and going four levels deep
Dim objFSO, objFolders, objFolderL1, objFolderL2
Dim objFolderL3, objFolderL4
Dim tmp_r
Set objFSO = Server.CreateObject("Scripting.FileSystemObject"
If objFSO.FolderExists(strPathName) Then
Set objFolders = objFSO.GetFolder(strPathName).SubFolders
For Each objFolderL1 In objFolders
If Left(objFolderL1.Name,3) = "l2d" Then
'Do what ever you need done to the Level one folders
tmp_r = tmp_r & objFolderL1.Name & ", "
'Goto Level 2
For Each objFolderL2 In objFolderL1.SubFolders
If Left(objFolderL2.Name,3) = "l2d" Then
'Do stuff to the Level 2 Folders
tmp_r = tmp_r & objFolderL2.Name & ", "
'Goto Level 3
For Each objFolderL3 In objFolderL2.SubFolders
If Left(objFolderL3.Name,3) = "l2d" Then
'Do what ever you need to the Level 3 Folders
tmp_r = tmp_r & objFolderL3.Name & ", "
'Goto Level 4
For Each objFolderL4 In objFolder3.SubFolders
If Left(objFolderL4.Name,3) = "l2d" Then
'Do stuff to the Level 4 Folders
tmp_r = tmp_r & objFolderL4.Name & ", "
End If
Next
End If
Next
End If
Next
End If
Next
Else
tmp_r = "Folder Does Not Exist"
End If
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.