How to create a new directory using code
I want to create a folder directory through code, but I don't know how to write it
Product version: IRIS 2020.1
Discussion (3)0
Comments
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 0That's great Thank you
As an addition to the above said
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)