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


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 also works with cloud objects.
- DirectoryQ[File["name"]] is also supported.
Examples
open all close allBasic 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 (2)
Check if the name specified as a File object corresponds to a directory:
Check that $CloudRootDirectory is a Directory:
Check that your current cloud working directory, CloudDirectory, is a directory:
See Also
FileType Directory DirectoryName CloudObject
Function Repository: FileQ EnsureDirectory EnsureFilePath
Related Guides
Text
Wolfram Research (2008), DirectoryQ, Wolfram Language function, https://reference.wolfram.com/language/ref/DirectoryQ.html (updated 2016).
CMS
Wolfram Language. 2008. "DirectoryQ." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2016. https://reference.wolfram.com/language/ref/DirectoryQ.html.
APA
Wolfram Language. (2008). DirectoryQ. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DirectoryQ.html
BibTeX
@misc{reference.wolfram_2025_directoryq, author="Wolfram Research", title="{DirectoryQ}", year="2016", howpublished="\url{https://reference.wolfram.com/language/ref/DirectoryQ.html}", note=[Accessed: 16-August-2025]}
BibLaTeX
@online{reference.wolfram_2025_directoryq, organization={Wolfram Research}, title={DirectoryQ}, year={2016}, url={https://reference.wolfram.com/language/ref/DirectoryQ.html}, note=[Accessed: 16-August-2025]}