Get path part can be useful for getting different parts of a path you have. If you want to get the file name only from a path for example.
uses System.IOUtils.TPath Methods
Activity properties
There are six different parts to retrieve from a path.
Gets the directory name of the file path.
Example:
Filepath = 'C:\Users\Username\Documents\Codolex\Project.fcp'.
begin var PathPart: string; PathPart := TPath.GetDirectoryName(FilePath); end; |
Result = 'C:\Users\Username\Documents\Codolex'
Gets the file name plus extension of the file path.
Example:
Filepath = 'C:\Users\Username\Documents\Codolex\Project.fcp'.
begin var PathPart: string; PathPart := TPath.GetFileName(FilePath); end; |
Result = 'Project.fcp'
Gets the file name without extension of the file path.
Example:
Filepath = 'C:\Users\Username\Documents\Codolex\Project.fcp'.
begin var PathPart: string; PathPart := TPath.GetFileNameWithoutExtension(FilePath); end; |
Result = 'Project'
Gets the extension of the file path.
Example:
Filepath = 'C:\Users\Username\Documents\Codolex\Project.fcp'.
begin var PathPart: string; PathPart := TPath.GetExtenstion(FilePath); end; |
Result = '.fcp'.
Gets the full path of the file path.
Example:
Filepath = 'C:\Users\Username\Documents\Codolex\Project.fcp'
begin var PathPart: string; PathPart := TPath.GetFullPath(FilePath); end; |
Result = 'C:\Users\Username\Documents\Codolex\Project.fcp'
Gets the root path of the file path.
Example:
Filepath = 'C:\Users\Username\Documents\Codolex\Project.fcp'
begin var PathPart: string; PathPart := TPath.GetPathRoot(FilePath); end; |
Result = 'C:\'
Providing an incorrect path will not result in errors, but may have unexpected outcomes.