GetParent(Path: String): IDirectoryInfo;
Path - a directory, which information about parent directory should be obtained.
The GetParent method returns information about a parent directory of a specified directory.
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;
While executing this example it is checked whether directory, specified in the parameter sPath, is present in file system. If a directory exists, date and time of its parent directory creation are displayed in development environment console.
See also: