Mwnci basename() Function

Syntax

basename(filepath)

Parameters

Parameter
Definition
filepath
Returns the last element of path.

Description

basename() returns the last element of path. Trailing path separators are removed before extracting the last element. If the path is empty, Base returns “.”. If the path consists entirely of separators, Base returns a single separator.

Example

Dir=getwd()
println(Dir)
println(basename(Dir))


/home/afry/Desktop
Desktop