Syntax
dirpath(path)
Description
dirpath() returns all but the last element of path, typically the path’s directory. After dropping the final element, trailing slashes are removed. It the path is empty, a “.” is returned. If the path consists entirely of separators, a single separator is returned. The returned path does not end in a separator unless it is the root directory.
Example
path="/path/to/some/file"
println("Full path to file is: ", path)
println("Path up-to file is: ",dirpath(path))
Full path to file is: /path/to/some/file
Path up-to file is: /path/to/some