Re: Directory[]
- To: mathgroup at smc.vnet.net
- Subject: [mg96169] Re: Directory[]
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Sat, 7 Feb 2009 03:40:19 -0500 (EST)
On 2/6/09 at 4:14 AM, hans.malissa at gmx.net (hmalissa) wrote:
>Directory[] gives the name of the Mathematica working directory. Is
>there a possibility to get the name of the directory in which the
>notebook file is located?
With version 6 and later, if the notebook has been saved,
NotebookDirector[] will return the directory for the notebook file.
For version 5.x the following function will do what you want
again assuming the notebook has been saved.
NotebookDirectory[]:=
DirectoryName@ToFileName["FileName"/.NotebookInformation@EvaluationNot=
ebook[]]];