DirectoryName: String;
The DirectoryName property returns a full path and a name of directory in which a file is located.
Sub Main;
Var
FileInf: IFileInfo;
s: String;
Begin
FileInf:=New FileInfo.Attach("c:\Work\1.txt");
If FileInf.Exists Then
s:=FileInf.DirectoryName;
End If;
Dispose FileInf;
End Sub Main;
After executing this example, variable "s" contains complete path and name of directory in which the file 1.txt is located.
See also: