Extracts the filename with extension, if there is one.

Syntax

Filename = SRP_Path("GetFilename", Path)

Parameters

ParameterDescription
PathA path with or without command line parameters.

Returns

The filename with the path.

Remarks

The GetFilename service extracts the last non-directory portion of a path, with the extension if there is one. If Path ends with a backslash, then the nothing is returned because a path ending in a backslash is assumed to be a directory.

Note. This method supports paths that contain command line parameters. In this case, command line parameters are simply ignored.

Example

Path = "C:\path1\path2\path3\filename.txt"
Result1 = SRP_Path("GetFilename", Path)
Result2 = SRP_Path("GetFilename", SRP_Path("RemoveBackslash", SRP_Path("GetDirectory", Path))

Result1 will be "filename.txt". Result2 will be "path3".

See Also

GetComponents, GetDirectory, GetExtension, GetParameters, GetPath, RemoveFilename

  • No labels