This is documentation for Mathematica 7, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

FileExistsQ

FileExistsQ["name"]
gives True if the file with the specified name exists, and gives False otherwise.
  • In FileExistsQ["name"], name is interpreted relative to your current directory.
  • FileExistsQ tests for files, directories or any other filesystem objects.
Check if a file exists:
Create a file:
Check if file exists:
Delete the file:
Check if a file exists:
In[1]:=
Click for copyable input
Out[1]=
 
Create a file:
In[1]:=
Click for copyable input
Check if file exists:
In[2]:=
Click for copyable input
Out[2]=
Delete the file:
In[3]:=
Click for copyable input
New in 7