GetParent(Path: String): IDirectoryInfo;
Path - directory, which information about parent directory must be obtained.
The GetParent method returns information about a parent directory of the 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;
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: