Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

Re: Directory ? Not the current working one !

  • To: mathgroup at smc.vnet.net
  • Subject: [mg72727] Re: Directory ? Not the current working one !
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Tue, 16 Jan 2007 04:03:50 -0500 (EST)
  • Organization: The Open University, Milton Keynes, UK
  • References: <eofimn$gd3$1@smc.vnet.net>

Laura Dabene wrote:
> Hi
> 
> 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.
> 
> Laura 
> 
> 
Hi Laura,

Say that the current notebook is called "jm.nb" and is located in the 
directory "C:\projects\", then the following expression returns the path 
without the file name.

In[1]:=
ToFileName[First["FileName" /. NotebookInformation[
EvaluationNotebook[]]]]

Out[1]=
C:\projects\

Regards,
Jean-Marc


  • Prev by Date: Re: On Mathematica notebook options
  • Next by Date: Re: Derivative recurrence
  • Previous by thread: Re: Directory ? Not the current working one !
  • Next by thread: Trouble with reading from file