[ ECLiPSe Operating System built-in.|Group Index| Full Index]

exists(+File)

Succeeds if the file File (with absolute or relative pathname) exists. File can be a directory.

+File
Atom or string.

Description

Used to see if the file File exists. File can be a directory. exists(File) is equivalent to get_file_info(File, mode, _).

Fail Conditions

Fails if the file File (with absolute or relative pathname) does not exist.

Resatisfiable

No.

Exceptions

(4) Instantiation fault
File is not instantiated.
(5) Type error
File is neither an atom nor a string.

Examples


Success:
   [eclipse]: sh('ls myfile').
   myfile
   [eclipse]: exists(myfile).
   yes.

   [eclipse]: sh('ls /home/user/workdir').
   myfile
   [eclipse]: exists('/home/user/workdir').
   yes.

Fail:
   [eclipse]: sh('ls nofile').
   nofile not found
   [eclipse]: exists(nofile).
   no.

Error:
   exists(File).                          (Error 4).
   exists([file]).                        (Error 5).


See Also

get_file_info / 3, sh / 1, system / 1, delete / 1, mkdir / 1