Question
· Nov 22, 2016

Cache Syntax - Directory Exists

I am trying to write some code to check to see if a directory exists before creating a new directory.

 

When I do the following I am not getting a response, but the directory exists..

do ##class(%File).DirectoryExists("/ensemble/")

am I missing something?

Discussion (5)1
Log in or sign up to continue

How do you expect to get the response in your command?

If you read documentation carefully, you will find:

classmethod DirectoryExists(filename As %String) as %Boolean

Tests if filename is a directory. returns 1 if it is a directory, otherwise, returns 0.

So, you should set the result of this function to some value.

set result=##class(%File).DirectoryExists("/ensemble/")