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 allclose all

Basic Examples  (2)

Check if the name corresponds to a directory:

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

Scope  (1)

Check if the name specified as a File object corresponds to a directory:

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