os.Path.basename

os.Path.basename() 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

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

When you specify a file name, be careful with its case.

UNIX is case-sensitive, so it will treat files which names come in different cases as separate files.

To return the last component of the path, os.Path.dirname() should be used.

 

 

Contact Us

Privacy Policy

Copyright © 2025 Querix, (UK) Ltd.