dirname

dirname — returns the directory path of a file.

Syntax

dirname (filename)

		

Arguments

filename

A file name as a string, including its directory path, as defined by the operating system.

Returns

The directory path of the filename, or if no path is entered, the filename.

Description

This function reads the filename and directory path as a string, returning the directory path as a string.

Example

Gamma> x = dirname("/usr/george/lib/misc/myfile.dat");
"/usr/george/lib/misc"
Gamma> y = dirname("misc/myfile.dat");
"misc"
Gamma> z = dirname("myfile.dat");
"myfile.dat"
Gamma> 
		

See Also

basename, root_path