Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'A small code which will set the directory to the directory of the current notebook' topicStudent Support Forum > General > "A small code which will set the directory to the directory of the current notebook"

Help | Reply To Topic
Author Comment/Response
Raja Kountanya
09/09/00 07:52am

Hello,
I just synthesized a small piece of code which may be of use to beginners and intermediate users.

This code upon execution sets the current working directory to that of the notebook from which it is run. This may be useful when a notebook is shifted from one place to another and it reads an input data file.

I know it is a ''piece of cake'' for pros in Mathematica, but for beginners like me it is a god sent routine.

I request the moderator to post it in the appropriate place.
Raja

SetDirectory[
ToFileName[NotebookInformation[SelectedNotebook[]][[1]][[2]][[1]]]]

URL: ,
Help | Reply To Topic