Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Re: notebook directory

  • To: mathgroup at smc.vnet.net
  • Subject: [mg61683] Re: notebook directory
  • From: albert <awnl at arcor.de>
  • Date: Wed, 26 Oct 2005 01:01:37 -0400 (EDT)
  • References: <djk2a8$h3o$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hannes Kessler wrote:

> Dear mathematica-experts,
> 
> 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.

This gets a FrontEnd`FileName of the full path to your notebook:

"FileName" /. NotebookInformation[EvaluationNotebook[]

And this will extract the directory, convert it to just a string and set
the directory accordingly:

SetDirectory[
ToFileName[First["FileName" /. NotebookInformation[EvaluationNotebook[]]]]
]

hth

albert


  • Prev by Date: Re: Complex numbers in Mathematica
  • Next by Date: Re: Re: Warning from Piecewise
  • Previous by thread: Re: ParametricPlot3D
  • Next by thread: Re: notebook directory