Extracts the dir part of a full file name SysUtils unit
 function ExtractFileDir(const FullFileName string):string;
The ExtractFileDir function extracts from FullFileName the directory substring.
This is the part of the full file name up to but not including the final \ before the file name.
Related commands
ChangeFileExtChange the extension part of a file name
ExtractFileDriveExtracts the drive part of a full file name
ExtractFileExtExtracts the extension part of a full file name
ExtractFileNameExtracts the name part of a full file name
ExtractFilePathExtracts the path part of a full file name
ProcessPathSplit a drive/path/filename string into its constituent parts
 Download this web site as a Windows program.

Example code : Extract all of the parts of a full file name
  fullFileName : string;

  // Set up a full file name with drive and path
  fullFileName := 'C:\Program Files\Borland\Delphi7\Projects\Unit1.dcu';

  // Show the component parts of this full name
  ShowMessage('Drive = '+ExtractFileDrive (fullFileName));
  ShowMessage('Dir   = '+ExtractFileDir   (fullFileName));
  ShowMessage('Path  = '+ExtractFilePath  (fullFileName));
  ShowMessage('Name  = '+ExtractFileName  (fullFileName));
  ShowMessage('Ext   = '+ExtractFileExt   (fullFileName));
Show full unit code
  Drive = C:
  Dir = C:\Program Files\Borland\Delphi7\Projects
  Path = C:\Program Files\Borland\Delphi7\Projects\
  Name = Unit1.dcu
  Ext = .dcu
Delphi Programming © Neil Moffatt . All rights reserved.  |  Home Page