os.Path.rootName

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

Syntax

os.Path.rootName(
   path STRING)
  RETURNS STRING
  1. path is the path to a file or directory.

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.