IDirectory.GetParent

Syntax

GetParent(Path: String): IDirectoryInfo;

Parameters

Path - directory, which information about parent directory must be obtained.

Description

The GetParent method returns information about a parent directory of the specified directory.

Example

Sub UserProc(sPath: String);
Var
    Culture: ICultureInfo;
    ParentDir: IDirectoryInfo;
    d: DateTime;
Begin
    If Directory.Exists(sPath) Then
        Culture := CultureInfo.Current;
        ParentDir := Directory.GetParent(sPath);
        d := ParentDir.CreationTime;
        Debug.WriteLine("Date and time of parent directory creation: " +
            Culture.FormatLongDate(d) + Culture.FormatTime(d));
    End If;
End Sub UserProc;

On executing the example it is checked if the directory specified in the sPath parameter is present in the file system. If the directory exists, date and time of its parent directory creation are displayed in the development environment console.

See also:

IDirectory