Macaulay2 » Documentation
Packages » Macaulay2Doc > The Macaulay2 language > file manipulation > fileExists
next | previous | forward | backward | up | index | toc

fileExists -- whether a file exists

Synopsis

Description

i1 : fn = temporaryFileName()

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

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

o3 = /tmp/M2-770820-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.