gives the directory of the current evaluation notebook.
NotebookDirectory [nb]
gives the directory for the notebook specified by nb.
NotebookDirectory
gives the directory of the current evaluation notebook.
NotebookDirectory [nb]
gives the directory for the notebook specified by nb.
Details
- NotebookDirectory returns the full name of the directory as a string.
- NotebookDirectory gives $Failed if the specified notebook has never been saved as a file.
- The directory given by NotebookDirectory is on the filesystem of the computer on which the notebook front end is being run.
Examples
open all close allBasic Examples (1)
Find the name of the directory containing the notebook file for this reference page:
Possible Issues (2)
There is no directory for a notebook that has been created but not yet saved:
If an evaluation was not directly triggered from within a notebook, there will be no directory:
See Also
NotebookFileName NotebookInformation Directory SetDirectory $Input $InputFileName FindFile
Function Repository: NotebookRelativePath
Tech Notes
Related Guides
Related Workflows
- Construct a File Path Programmatically
History
Text
Wolfram Research (2007), NotebookDirectory, Wolfram Language function, https://reference.wolfram.com/language/ref/NotebookDirectory.html.
CMS
Wolfram Language. 2007. "NotebookDirectory." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/NotebookDirectory.html.
APA
Wolfram Language. (2007). NotebookDirectory. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/NotebookDirectory.html
BibTeX
@misc{reference.wolfram_2025_notebookdirectory, author="Wolfram Research", title="{NotebookDirectory}", year="2007", howpublished="\url{https://reference.wolfram.com/language/ref/NotebookDirectory.html}", note=[Accessed: 05-December-2025]}
BibLaTeX
@online{reference.wolfram_2025_notebookdirectory, organization={Wolfram Research}, title={NotebookDirectory}, year={2007}, url={https://reference.wolfram.com/language/ref/NotebookDirectory.html}, note=[Accessed: 05-December-2025]}