DirectoryName: String;
The DirectoryName property returns the full path and name of the 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 the example, the "s" variable contains complete path and name of the folder, in which the 1.txt file is located.
See also: