Wolfram Research

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

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

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

Scope

Build a path from subdirectories relative to the current notebook:

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

Requirements

Wolfram Language 11.3 (March 2018) or above

Resource History

License Information