Extracts the entire path except the last component.

Syntax

Directory = SRP_Path("GetDirectory", Path)

Parameters

ParameterDescription
PathA path with or without command line parameters.

Returns

The directory portion of the path.

Remarks

The GetDirectory service extracts the entire path except the last component. The directory will be returned with the backlash at the end. If Path already ends with a backslash, then the whole path 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("GetDirectory", Path)
Result2 = SRP_Path("GetDirectory", Result1)
Result3 = SRP_Path("GetDirectory", SRP_Path("RemoveBackslash", Result2))

Result1 and Result2 will both be "C:\path1\path2\path3\". Result3 will be "C:\path1\path2\".

See Also

GetComponents, GetExtension, GetFilename, GetParameters, GetPath, RemoveDirectory

  • No labels