Grandchildren files and count

Returns list of files in 2 level folders
Will not find files as children of HTMLFolder, instead will only find grandchildren
Returns as ANStr list of files in rows
Foldername1{$C$}Filename {$C$} Filesize {$C$} Datemodified
That is separated by {$R$} per file returned
Also anothe function to get only total count of these grandchildren files.

CodeFunctionName
What is this?

Public

Tested

Original Work
Function FilesGrandChildren_in(HTMLFolder, SepaR, SepaC)
    ' Returns list of files in 2 level folders
    '    Will not find files as children of HTMLFolder, instead will only find grandchildren
    '    Returns Foldername1{$C$}Filename {$C$} Filesize {$C$} Datemodified
    Rett2                        = ""
    If SepaR = "" Then SepaR = "{$R$}"
    If SepaC = "" Then SepaC = "{$C$}"
    Dim fodd, ChildF, GrandChild
    ServerFolder            = Server.MapPath(HTMLFolder)
    Set fodd                    = fs.GetFolder(ServerFolder)
    ' Rett = fodd.name
    For Each ChildF In fodd.SubFolders
        ChildName            = ChildF.Name
        For Each GrandChild In ChildF.files
            Rett2                = Rett2 & IIF(Rett2 = "", "", SepaR) & ChildName & SepaC & GrandChild.Name & SepaC & GrandChild.Size & SepaC & GrandChild.DateLastModified
        Next
    Next
    Set fodd                    = Nothing
    FilesGrandChildren_in                     = Rett2
End Function
Function FilesGrandChildren_in_Count(HTMLFolder)
    Rett                         = 0
    ServerFolder            = Server.MapPath(HTMLFolder)
    Set fo                     = fs.GetFolder(ServerFolder)
    For Each ChildF In fo.SubFolders
        Rett                    = Rett + ChildF.Files.Count
    Next
    FilesGrandChildren_in_Count = Rett
End Function

HTMLFolder, SepaR, SepaC
or
HTMLFolder

Views 138

Downloads 63

CodeID
DB ID