MathGroup Archive 2005

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

Search the Archive

Re: notebook directory

  • To: mathgroup at smc.vnet.net
  • Subject: [mg61684] Re: notebook directory
  • From: Marcus Stollsteimer <marcus314 at yahoo.com>
  • Date: Wed, 26 Oct 2005 01:01:38 -0400 (EDT)
  • Organization: Comp.Center (RUS), U of Stuttgart, FRG
  • References: <djk2a8$h3o$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.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?

Hi Hannes,

I use the following function, which is defined in my always loaded
initialization package:

SetDirToNotebookDir::usage=
    "SetDirToNotebookDir[] sets the working directory to the directory
of the evaluated notebook.";
SetDirToNotebookDir[]:=Module[{MyNotebookDir},
    MyNotebookDir=
      DirectoryName@
        ToFileName@("FileName"/.NotebookInformation[
                  EvaluationNotebook[]]/.{"FileName"\[Rule]""});
    If[MyNotebookDir\[NotEqual]"",SetDirectory[MyNotebookDir]]
    ]

hth,
Marcus

-- 
It is awfully hard work doing nothing. -- Oscar Wilde


  • Prev by Date: Re: Test for "valid variable"
  • Next by Date: Re: 3D plots in different colors
  • Previous by thread: Re: notebook directory
  • Next by thread: Test for "valid variable"