File.getDirectory

Overview | Methods | This Package | All Packages

File.getDirectory

Retrieves the directory path of a file path.

Syntax

public static String getDirectory( String path )

Parameters

path

The path of a file or directory.

Return Value

Returns the directory path of the specified path, or returns null if the specified path includes a root.

Remarks

This method effectively removes the last element of the specified file path; for example, it returns a string consisting of all characters up to but not including the last backslash (\) in the file path. The returned value is null if the file path is null or if the file path includes a root, such as backslash (\), C:, or \\server\share.

See Also   getExtension, getName, getRoot, isRooted