file join

Joins parts into one path.

file join NAME ?NAME ...?

Description

Joins each NAME with /. A NAME that is an absolute path, such as /b, starts the path again and drops the parts before it. A / at the end of a part does not double. The result is text: .. and . stay as they are.

Arguments

ArgumentTypeDefaultDescription
NAMEpathrequiredA part of the path, at least one.

Returns

The path.

Examples

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

% file join a /b c
/b/c

% file join a b/ c
a/b/c

% file join a ../b
a/../b

Errors

% file join
wrong # args: should be "file join name ?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