os.Path.dirname

The os.Path.dirname method is used to return all components of a path excluding the last one. The syntax of its invocation is as follows:

 

CALL os.Path.dirname(file_name STRING) RETURNING dir_name STRING

 

where:

·         file_name = a STRING variable standing for the file name,

·         dir_name = a STRING variable containing all the path elements except the last one.

 

Usage

As the function invocation removes the last path component, passing \root\dir001\file.txt as the parameter, for example, will result in \root\dir001