|        | |||||
|  | |||||
| operator | file...exists | ||||
| Sample Code | Related Concepts | ||||
| Summary | Boolean Returns true if the named file exists and false otherwise. | 
file string-expression exists
An operator that tests whether a named file exists. Useful for avoiding overwriting a file that already exists with a new one.
For example, the following shows how a file...exists test can be used to avoid overwriting an existing file:
  global stream error-strm
  ...
  do when file "errors.log" exists
    put #error "File errors.log already exists.%n"
    put #error "Please delete or rename it before running this program.%n"
    halt with 1
  else
    open error-strm as file "errors.log"
  done
| Sample Code External text entities: processing External text entity rules: default | Related Concepts File tests Security considerations | 
| ---- |