DirectoryQ

DirectoryQ["name"]

gives True if the directory with the specified name exists, and gives False otherwise.

Details

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

Examples

open all close all

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]=

Scope  (1)

Introduced in 2008
(7.0)
|
Updated in 2016
(11.0)