Skip to main content

1E SDK

BASENAMEFROMPATH

Function

BASENAMEFROMPATH

Action

Takes a path as a string and returns the basename.

Parameters

(string) Full path and filename.

Return values

(string) Basename (filename with file extension if present).

Example

// Returns "file.txt"
SELECT BASENAMEFROMPATH("c:\\tmp\\things\\file.txt") AS Basename;

Notes

The function is not file system aware; it does not check to see if the path of file exists.

The function is OS aware; it assumes the directory separator is \ on Windows and / on other OS.

Like the UNIX basename command, it returns everything after the last path separator character in the string supplied, however this version does not support removing the suffix (extension) from the basename.