os.Path.dirname() is used to return all components of a path excluding the last one:
CALL os.Path.dirname(file_name STRING) RETURNING dir_name STRING
where:
As the function invocation removes the last path component, passing \root\dir001\file.txt as the parameter, for example, will result in \root\dir001.
When you specify file and directory names, be careful with their case.
UNIX is case-sensitive, so it will treat files and directories which names come in different cases as separate files.