file dirname

Gives a path with no last part.

file dirname NAME

Description

Gives NAME with its last part removed. A name of one relative part gives ., and /a and / give /.

Arguments

ArgumentTypeDefaultDescription
NAMEpathrequiredThe path.

Returns

The path of the folder.

Examples

% file dirname notes/2026/a.json
notes/2026

% file dirname a.json
.

% file dirname /a
/

Errors

% file dirname
wrong # args: should be "file dirname name"
-errorcode TCL WRONGARGS

Facts

Capability
file. A new interpreter does not have it until the host turns it on.
Tcl release
Tcl 9.1 and 8.6.
Since
ztcl 1.0.0-beta.1

See also