PING  0.9
Statistical data handling and processing in production environment
dir_check

Check the existence of a directory.

%let ans=%dir_check(dir, mkdir=NO);

Arguments

  • dir : a full path directory;
  • mdkir : (option) boolean flag (yes/no) set to force the creation of the directory when it does not already exist.

Returns

ans : error code for the test of prior existence of the input directory (hence, independent of the mkdir option), i.e.:

  • 0 when the directory exists (and can be opened), or
  • 1 (error) when the directory does not exist, or
  • -1 (error) when the fileref exists but cannot be opened as a directory.

Example

Just try on your "root" path, so that:

%let ans=&dir_check(&G_PING_ROOTPATH);

will return ans=0.

Run macro %_example_dir_check for more examples.

Note

The response and returned by the macro relates to the prior existence of the directory. Therefore, even when a directory is created thanks to the option mkdir=YES, the answer may be ans=0.

See also

%ds_check, %lib_check, %file_check, FEXIST, FILENAME, DOPEN.