Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question

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

This question was marked as an exact duplicate of an existing question.

    
I have marked this as a duplicate. If you feel that your question is not addressed there please tell me why. – Mr.Wizard Jan 3 '14 at 9:46
up vote 0 down vote accepted

This is data directory (OS independent) :-

FileNameJoin@Append[FileNameSplit@NotebookDirectory[], "data"]
share|improve this answer
3  
Why not just FileNameJoin[{NotebookDirectory[], "data"}]? – MikeLimaOscar Jan 3 '14 at 9:31
    
Yup, somehow missed that. Thanks. – Chris Degnen Jan 3 '14 at 9:52

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