os.Path.dirName
Returns all components of a path excluding the last one.
Syntax
os.Path.dirName(
path STRING)
RETURNS STRING
- path is the path to a file or directory.
Usage
This method removes the last component of a path provided as argument.
For example, if you pass "/root/dir1/file.ext" as the parameter, it will return "/root/dir1".
See Example 1: Filename parts for more examples.