File Functions
Use file functions to return information about a file name or path. For example, you might use a file function to remove a file extension from a file path or to return part of the path.
You can replace any argument with a literal or an expression that evaluates to the argument. String literals must be enclosed in single or double quotation marks.
Not valid in Data Collector Edge pipelines. Do not use file functions in Data Collector Edge pipelines.
The expression language provides the following file functions:
- file:fileExtension(<filepath>)
- Returns the file extension from a file path. Uses the following argument:
- filepath - An absolute path to a file.
- file:fileName(<filepath>)
- Returns the file name from a file path. Uses the following argument:
- filepath - An absolute path to a file.
- file:parentPath(<filepath>)
- When used with a path to a file, returns the path to the file without the
final separator, such as
/files
for/files/file.log
. - file:pathElement(<filepath>, <integer>)
- Returns the part of a path based on the specified integer. Uses the
following arguments:
- filepath - An absolute path to a file.
- integer - The section of a path to return. Can return parts starting
from the left or right side of the path:
- To return a section of a path, counting from the left side of the path, use 0 and positive integers and start with 0.
- To return a section of a path, counting from the right side of the path, use negative integers and start with -1.
- file:removeExtension(<filepath>)
- Returns the file path without the file extension. Uses the following
argument:
- filepath - An absolute path to a file.