Function Repository Resource:

NotebookRelativePath

Source Notebook

Return the full path to a file relative to the current notebook

Contributed by: Flip Phillips

ResourceFunction["NotebookRelativePath"]["name"]

creates an absolute, notebook-relative path to name.

ResourceFunction["NotebookRelativePath"][{"name1","name2",}]

creates an absolute, notebook-relative path to the path specified in namei.

Details and Options

ResourceFunction["NotebookRelativePath"] returns $Failed if the notebook has not been saved.

Examples

Basic Examples (1) 

Get the path to a file relative to the current notebook:

In[1]:=
ResourceFunction["NotebookRelativePath"]["data.csv"]
Out[1]=

Scope (1) 

Build a path from subdirectories relative to the current notebook:

In[2]:=
ResourceFunction[
 "NotebookRelativePath"][{"Data", "CSVs", "data1.csv"}]
Out[2]=

Publisher

Flip Phillips

Requirements

Wolfram Language 11.3 (March 2018) or above

Version History

  • 1.0.0 – 19 March 2019

License Information