Re: Directory ? Not the current working one !
- To: mathgroup at smc.vnet.net
- Subject: [mg72705] Re: Directory ? Not the current working one !
- From: Helen Read <hpr at together.net>
- Date: Tue, 16 Jan 2007 02:35:19 -0500 (EST)
- 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
ToFileName[("FileName" /. NotebookInformation[EvaluationNotebook[]])[[1]]]
And if you want to set the working directory to the directory where your
file lives, use:
SetDirectory[ToFileName[("FileName" /.
NotebookInformation[EvaluationNotebook[]])[[1]]]]
--
Helen Read
University of Vermont