set mydir="C:\dir1\dir2\newdir"//// creates newdir ONLY if dir1 and dir2 existswrite##class(%File).CreateDirectory(mydir)
// creates newdir and, IF NECESSARY, the intermediate directories dir2 and dir1 toowrite##class(%File).CreateDirectoryChain(mydir)
Hi @Lingnan Zhang
You can use %File API class to create a directory. This result will be 1 if directory is created else 0. Refer the sample code below
set directory="c:\Test" write ##class(%File).CreateDirectory(directory) ; result will be 1 if create else 0
That's great Thank you
As an addition to the above said
set mydir="C:\dir1\dir2\newdir" // // creates newdir ONLY if dir1 and dir2 exists write ##class(%File).CreateDirectory(mydir) // creates newdir and, IF NECESSARY, the intermediate directories dir2 and dir1 too write ##class(%File).CreateDirectoryChain(mydir)