next | previous | forward | backward | up | top | index | toc | Macaulay2 website
Macaulay2Doc > The Macaulay2 language > file manipulation > fileExists

fileExists -- whether a file exists

Synopsis

Description

i1 : fn = temporaryFileName()

o1 = /tmp/M2-62420-0/0
i2 : fileExists fn

o2 = false
i3 : fn << "hi there" << close

o3 = /tmp/M2-62420-0/0

o3 : File
i4 : fileExists fn

o4 = true
i5 : removeFile fn
If fn refers to a symbolic link, then whether the file exists is determined by the content of the link and whether there is a file with the new path determined by it. The presence of a symbolic link can be detected with readlink.

For the programmer

The object fileExists is a compiled function.