FilesIn + FilesIn_Count

Returns list of files found in a folder, list separated with custom separator
And FilesIn_Count to return number of files
Using Dir not FSO

CodeFunctionName
What is this?

Public

Tested

Original Work
Function FilesIn(Optional FileMask = "*.*", Optional InFolder = "", Optional Attr = 0, Optional Sepa = "|")
    Retu = ""
    On Error GoTo ByeBye
    di = Dir(FixPath(InFolder) & FileMask, Attr)
    Do Until di = ""
        If di = "." Or di = ".." Then GoTo 300
        If Retu > "" Then Retu = Retu & Sepa
        Retu = Retu & di
300:
        di = Dir
    Loop
ByeBye:
    On Error GoTo 0
    FilesIn = Retu
End Function

Function FilesIn_Count(Optional FileMask = "*.*", Optional InFolder = "", Optional Attr = 0, Optional Sepa = "|")
    Retu = 0
    On Error GoTo ByeBye
    di = Dir(FixPath(InFolder) & FileMask, Attr)
    Do Until di = ""
        If di = "." Or di = ".." Then GoTo 300
        Retu = Retu + 1
300:
        di = Dir
    Loop
ByeBye:
    On Error GoTo 0
    FilesIn_Count = Retu
End Function

FileMask, InFolder, Attr, Sepa

Views 3,375

Downloads 1,433

CodeID
DB ID

ANmarAmdeen
626
Attachments
Revisions

v3.0

Saturday
November
11
2023
Needs