root_path

root_path --  strips the final file or directory name from a path.

Syntax

root_path (path)

		

Arguments

path

A file path name, as a string.

Returns

The portion of the path with the file name and any trailing directory separators removed.

Description

This function strips the final file or directory name from the path to produce its parent. Any trailing directory separators are also removed. If the path represents the root of the file system then it is unmodified.

Example

    Gamma> x = "/usr/doc/FAQ";
    "/usr/doc/FAQ"
    Gamma> x = root_path(x);
    "/usr/doc"
    Gamma> x = root_path(x);
    "/usr"
    Gamma> x = root_path(x);
    "/"
    Gamma> x = root_path(x);
    "/"
    Gamma> 
    		

See Also

basename, dirname

Copyright 1995-2002 by Cogent Real-Time Systems, Inc.