dirname

Returns the directory name from a path name.

dirname <strvar> <path>

Remarks

Given a <path> pathname, this macro will delete any suffix beginning with the last slash('/') character and return the result into the <strvar> variable name.
The pathname will need not be existed.

Both '/' and '\' are accepted as folder separators.

Example

dirname dir '/Users/user/teraterm/test.txt'
; dir = "/Users/user/teraterm"
dirname dir '/Users/user/teraterm/'
; dir = "/Users/user"
dirname dir '/Users/user/teraterm'
; dir = "/Users/user"

See also