FoldersIn5

Creates list of subfolders and subfolders of each down to 5 levels
Folder passed must be HTMLFolder, function will convert it to server folder with mappath
Separated by custom char
Down to 5 levels deep

CodeFunctionName
What is this?

Public

Tested

Original Work
Function FoldersIn5(Path_MapPathed, Path_UpMapPathed, Sepa)
FoldersIn5 = ""
MainFo = ""
If FilePath_MapPathed > "" And FilePath_UnMapPathed = "" Then
MainFo = FilePath_MapPathed
ElseIf FilePath_MapPathed = "" And FilePath_UnMapPathed > "" Then
MainFo = Server.MapPath(FilePath_UnMapPathed)
End If
IF MainFo = "" Then Exit Function
If Sepa = "" Then Sepa = "|"
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
Set FolderObject = FSO.GetFolder(MainFo)
For Each item In FolderObject.subFolders
If Rett > "" Then Rett = Rett & Sepa
Rett = Rett & item.name
Parent1 = item.name
For Each it2 in item.subFolders
If Rett > "" Then Rett = Rett & Sepa
Rett = Rett & Parent1 & "/" & It2
Parent2 = Parent1 & "/" & it2.name
For Each it3 in it2.subFolders
If Rett > "" Then Rett = Rett & Sepa
Rett = Rett & Parent2 & "/" & It3
Parent3 = Parent2 & "/" & it3.name
For Each it4 in it3.subFolders
If Rett > "" Then Rett = Rett & Sepa
Rett = Rett & Parent3 & "/" & It4
Parent4 = Parent3 & "/" & it4.name
For Each it5 in it4.subFolders
If Rett > "" Then Rett = Rett & Sepa
Rett = Rett & Parent4 & "/" & It5
Next
Next
Next
Next
Next
FoldersIn5 = Rett
End Function

MainFo, Sepa

Views 3,350

Downloads 1,376

CodeID
DB ID