PathDirectoryName Procedure
Gets the path of the parent directory that contains the given directory or file.
Use
PathFileName to return the filename part of the path.
This is done by removing the last path component from the string.
No disk access is performed and the path does not need to actually exist.
Declaration
function PathDirectoryName(path as String) as String
Parameters
- path as String — Path to a directory or file.
Return value
String — Parent directory path.
Example
Code
dim path = "C:\Users\user\Documents\myfile.txt"
print PathDirectoryName(path)
print PathFileName(path)
Output
C:\Users\user\Documents
myfile.txt