MathGroup Archive 2005

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

Search the Archive

Re: notebook directory

  • To: mathgroup at smc.vnet.net
  • Subject: [mg61672] Re: notebook directory
  • From: Bill Rowe <readnewsciv at earthlink.net>
  • Date: Tue, 25 Oct 2005 01:28:05 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

On 10/24/05 at 9:07 PM, HannesKessler at hushmail.com (Hannes Kessler)
wrote:

>its a typical situation that I want to analyze some data files in
>the same directory where the mathematica-notebook is located. Is
>there a possibility to open the notebook and set the current
>working directory in a different way than issuing a manual
>SetDirectory["...\specific_directory"] command?

>Ideally, there should be some something like a state variable
>$NotebookDirectory one could refer to.

I've put the following into my init.m file

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

In any notebook that has been saved, this allows me to insert

SetDirectory@NotebookDirectory[]

in the notebook to have the current working directory set to the directory in which that notebook exists.
--
To reply via email subtract one hundred and four


  • Follow-Ups:
  • Prev by Date: Re: notebook directory
  • Next by Date: Re: Complex numbers in Mathematica
  • Previous by thread: Re: notebook directory
  • Next by thread: ParametricPlot3D