---
url: >-
  /statelake/scripting-reference/functions-and-procedures/file-functions/excludetrailingpathdelimiter.md
---

# ExcludeTrailingPathDelimiter

The function **ExcludeTrailingPathDelimiter** returns the file path without a path delimiter on the end.

If the file path does not already have a delimiter on the end, then nothing will happen and the result will be the same as the input parameter.

However, if there is more than one (**1**) final delimiter on the input path name, then only the last one will be excluded.

**Declaration**: Function ExcludeTrailingPathDelimiter( const S : string) : string

Simple examples.

```pascal
procedure ScriptEvent (var Value : variant);
var
  f: string;
begin
 //Returns 'C:\test'
  f := ExcludeTrailingPathDelimiter('C:\test\');
  LogInfo(f);

 //Returns 'C:\MyFiles\test'
  f := ExcludeTrailingPathDelimiter('C:\MyFiles\test');
  LogInfo(f);

 //Returns 'C:\MyFiles\test\'
  f := ExcludeTrailingPathDelimiter('C:\MyFiles\test\\');
  LogInfo(f);

 //Returns 'C:\MyData\MyFiles\test'
  LogInfo(ExcludeTrailingPathDelimiter('c:\MyData\MyFiles\test\'));
  LogInfo('');
end;
```
