Question
· Aug 30, 2016

How to get folder list in the hosting OS from Caché

Hi All,
How to get the only folders (with sub-folder)from the particular drive using cache.
We need to create the only folders from some drive using Cache.

Discussion (4)0
Log in or sign up to continue

Please note that this example uses the old (deprecated) dot-syntax for the loop. It also loops through your data twice. Nowadays you would write the same more like this:

#include %occInclude
ListDir
 set statement=##class(%SQL.Statement).%New()
 set status=statement.%PrepareClassQuery("%File","FileSet")
 if $$$ISERR(status) { do $system.OBJ.DisplayError(status) }
 set resultset=statement.%Execute("c:\temp","*","",1)
 while resultset.%Next() {
    write:resultset.%Get("Type")="D" !, resultset.%Get("Name")
 }