Skip to content

Extract file path ​

ts
function ExtractPath(fullyQualifiedFileName: string): string;

Returns the directory path portion of a fully qualified file name, excluding the file name itself.

Parameters ​

NameTypeDescription
fullyQualifiedFileNamestringFull path including directories and file.

Returns ​

A string containing the directory path. If the file is in the root directory, returns an empty string or "/" depending on the platform.

NOTE

The returned path does not include the file name. Handles both absolute and relative paths.

Example ​

ts
var res = ExtractPath('/docs/sheets/budget.xlsx');
// res will be "/docs/sheets"