Hi Community,
I recently needed to interrogate some folders/sub-folders to retrieve filenames using cache object script(COS) and I implemented it in the following way.
ClassMethod ListDir(
path = "",
wildchar = "*",
recursive As %String(VALUELIST=",y,n") = "y",
ByRef dirlist)
{
i path'=""{
i ##class(%File).DirectoryExists(path){
s rs=##class(%ResultSet).%New("%File:FileSet")
s sc=rs.