dirname

Table of Contents

Prototype: dirname(path)

Return type: string

Description: Return the parent directory name for given path.

This function returns the directory name for path. If path is a directory, then the name of its parent directory is returned.

Arguments:

  • path: string, in the range: .*

Example:

body common control
{
      bundlesequence => { "example" };
}

bundle agent example
{
  vars:
      "apache_dir" string => dirname("/etc/apache2/httpd.conf");
  reports:
      "apache conf dir = $(apache_dir)";
}

Output:

R: apache conf dir = /etc/apache2

Notes:

History: Was introduced in 3.3.0, Nova 2.2.0 (2011)

See also: lastnode(), filestat(), splitstring().