os.Path.rootName

Returns the file path without the file extension of the last element of the file path.

Syntax

os.Path.rootName(
   filename STRING)
  RETURNING result STRING
  1. filename is the file path.

Usage

This method removes the file extension from the path provided as parameter.

For example, if you pass "/root/dir1/file.ext" as the parameter it will return "/root/dir1/file".

See Example 1: Extracting the parts of a file name for more examples.