dash.file.relativePath

Determine the relative path to a file from a folder


Syntax



Description

[path, isrelative] = dash.file.relativePath(toFile, fromFolder)

Attempts to determine the relative path to a file from a folder. If the file and folder are located on separate drives, uses the absolute file path. Returns the path to the file and indicates whether the path is a relative or absolute path.


Input Arguments

toFile

string scalar
The absolute path to a file

fromFolder

string scalar
The absolute path to a folder

Output Arguments

path

string
The relative path to the file, or the absolute path if the file and folder are on different drives. If a relative path, begins with ./

isrelative

scalar logical
True if path is a relative path. False if the path is an absolute path.