DirectoryQ

DirectoryQ["name"]
gives True if the directory with the specified name exists, and gives False otherwise.

DetailsDetails

  • In DirectoryQ["name"], name is interpreted relative to your current directory.

ExamplesExamplesopen allclose all

Basic Examples  (2)Basic Examples  (2)

Check if the name corresponds to a directory:

In[1]:=
Click for copyable input
Out[1]=

The result is False if the file is not a directory or does not exist:

In[1]:=
Click for copyable input
Out[1]=
Introduced in 2008
(7.0)