2
$\begingroup$

This question already has an answer here:

To maintain mobility of project files, I want to use relative paths in my notebooks. For example, I have a directory named "proj" and my notebook file is located in this directory. Meanwhile, I have to import something from directory "proj/data/". How do I get a relative path to "data"? I want to do this because I might move "proj" somewhere else in my file system.

$\endgroup$

marked as duplicate by Mr.Wizard Jan 3 '14 at 9:45

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ I have marked this as a duplicate. If you feel that your question is not addressed there please tell me why. $\endgroup$ – Mr.Wizard Jan 3 '14 at 9:46
0
$\begingroup$

This is data directory (OS independent) :-

FileNameJoin@Append[FileNameSplit@NotebookDirectory[], "data"]
$\endgroup$
  • 3
    $\begingroup$ Why not just FileNameJoin[{NotebookDirectory[], "data"}]? $\endgroup$ – MikeLimaOscar Jan 3 '14 at 9:31
  • $\begingroup$ Yup, somehow missed that. Thanks. $\endgroup$ – Chris Degnen Jan 3 '14 at 9:52

Not the answer you're looking for? Browse other questions tagged or ask your own question.