[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'sysutils' (#rtl)

# ExtractFilePath

Extract the path from a filename.

## Declaration

Source position: finah.inc line 23

`function ExtractFilePath(`
`const FileName: UNICODESTRING`
`):UNICODESTRING; function ExtractFilePath(`
`const FileName: RAWBYTESTRING`
`):RAWBYTESTRING;`

## Description

ExtractFilePath returns the path part (including drive letter) from FileName. The path consists of all characters before the last directory separator character ('/' or '\'), including the directory separator itself. In case there is only a drive letter, that will be returned.

The full filename can always be reconstructed by concatenating the result of ExtractFilePath and ExtractFileName.

For an example, see ExtractFileDir.

## Errors

None.

## See also

ExtractFileName |  | Extract the filename part from a full path filename.
ExtractFilePath |  | Extract the path from a filename.
ExtractFileDir |  | Extract the drive and directory part of a filename.
ExtractFileDrive |  | Extract the drive part from a filename.
ExtractFileExt |  | Return the extension from a filename.
ExtractRelativePath |  | Extract a relative path from a filename, given a base directory.