MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Directory ? Not the current working one !


On 1/15/07 at 4:59 AM, laura.dabene at yahoo.it (Laura Dabene) wrote:

>I need a way to detect the directory a notebook has been saved in,
>but none gotten by mean of ?*Directory* seems to be useful.

>As example, if MyNotebook.nb was saved in c:\MyDirectory I would
>love to get

>In  = WhereDoIDwell[] Out = "c:\MyDirectory"

>instead of the current working directory as given by Directory[].

>Any hints ? Thanks you a lot.

The following function will do what you want

NotebookDirectory[]:=
     DirectoryName@ToFileName["FileName"/.NotebookInformation@EvaluationNotebook[]]

Note this will only return the desired directory when it is 
executed within a notebook that has been saved.
--
To reply via email subtract one hundred and four


  • Prev by Date: Re: Trouble with reading from file
  • Next by Date: Re: Re: Re: Re: Limit and Root Objects
  • Previous by thread: Re: Directory ? Not the current working one !
  • Next by thread: Re: Directory ? Not the current working one !