Exists - Maple Help

FileTools

 Exists
 determine if a file exists in the file system or in the Workbook

 Calling Sequence Exists(file)

Parameters

 file - filename, the file descriptor of an open file or Workbook URI

Description

 • The Exists(file) command checks the file system for a specified file. If the file exists, Exists returns true; otherwise, it returns false.
 • If the file parameter is a Workbook URI, then the existence check is performed in a specified Workbook.

Examples

Working with files

 > $\mathrm{FileTools}\left[\mathrm{Text}\right]\left[\mathrm{WriteFile}\right]\left("file","data"\right)$
 ${4}$ (1)
 > $\mathrm{FileTools}\left[\mathrm{Exists}\right]\left("file"\right)$
 ${\mathrm{true}}$ (2)
 > $\mathrm{FileTools}\left[\mathrm{Exists}\right]\left("doesnotexist"\right)$
 ${\mathrm{false}}$ (3)
 > $\mathrm{FileTools}\left[\mathrm{Remove}\right]\left("file"\right)$

Working with Workbook

 > $\mathrm{FileTools}\left[\mathrm{Exists}\right]\left("maple://Start.maple/Start"\right)$
 ${\mathrm{true}}$ (4)
 > $\mathrm{FileTools}\left[\mathrm{Exists}\right]\left("maple://Start.maple/Images/NewDocument.png"\right)$
 ${\mathrm{true}}$ (5)
 > $\mathrm{FileTools}\left[\mathrm{Exists}\right]\left("maple://Start.maple/Entry that does not exist"\right)$
 ${\mathrm{false}}$ (6)

Compatibility

 • The FileTools[Exists] command was updated in Maple 2016.