Directory Exists on Novell

Published ByDateVersionKnowledge LevelKeywords
Sprezzatura Ltd01 APR 19901.16+EXPERTNETWORK, OSOPEN, STATUS, OSWRITE, OSDELETE, DIRECTORY, NOVELL

Following on from an earlier article in which we showed how to check for the existence of a directory using OSOPEN and STATUS(), Claudio Aretusi of Michael D Atkin & Associates has submitted the following code to check for the existence of a directory under Novell (OSOPEN wouldn't work here as we are not interfacing with DOS anymore).

  FUNCTION CHECKDIR(DIR)
  *
  *    Author    Claudio Aretusi
  *    Date November 2, 1989
  *    Purpose   To check if given directory exists
  *
  DECLARE FUNCTION UNASSIGNED
  IF UNASSIGNED(DIR) THEN DIR = ""
  *    Normalise directory string to end in '\'
  DIR := '\'
  SWAP '\\' WITH '\' IN DIR
  OSWRITE 'DUMMY' TO DIR : "MDATEST.XXX"
  STAT = STATUS()
  IF STAT = 0 THEN
       * File created OK, dir exists, so delete test file
       OSDELETE DIR : "MDATEST.XXX"
       RETURN 1
  END ELSE
       * File not created, dir does not exist
       RETURN 0
  END

(Volume 1, Issue 10, Page 10)