Re: Directory ? Not the current working one !
- To: mathgroup at smc.vnet.net
- Subject: [mg72721] Re: Directory ? Not the current working one !
- From: Bill Rowe <readnewsciv at sbcglobal.net>
- Date: Tue, 16 Jan 2007 03:39:43 -0500 (EST)
On 1/15/07 at 4:59 AM, laura.dabene at yahoo.it (Laura Dabene) wrote: >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. The following function will do what you want NotebookDirectory[]:= DirectoryName@ToFileName["FileName"/.NotebookInformation@EvaluationNotebook[]] Note this will only return the desired directory when it is executed within a notebook that has been saved. -- To reply via email subtract one hundred and four