os.Path.basename

The os.Path.basename method is used to return a string value standing for the last path element. The syntax of the method is as follows:

CALL os.Path.basename(file_name) RETURNING base_name

 

where:

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

·     base_name = a STRING variable standing for the last path element.

 

Usage

 

As the function invocation extracts the last path element of the path, passing "\root\dir001\file.txt" as the parameter will return "file.txt", for example.

To remove the last component of the path, the os.Path.dirname method should be used.