Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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 has been asked before and already has an answer. If those answers do not fully address your question, please ask a new 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

1 Answer 1

up vote 0 down vote accepted

This is data directory (OS independent) :-

FileNameJoin@Append[FileNameSplit@NotebookDirectory[], "data"]
share|improve this answer
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.