FoxPro JustPath() function

The VFP JustPath() function returns the path to a file or a folder.

JustPath ("C:\Microsoft Visual FoxPro 9\vfp9.exe")

would return:

"C:\Microsoft Visual FoxPro 9"

JustPath() will also accept the name of a folder and will return the path to that folder. There is however a subtle difference in its behaviour depending on whether the folder name ends with a backslash. If there is no backslash then you get the path to that folder:

JustPath ("C:\Microsoft Visual FoxPro 9")

would return:


But if there is a already a final backslash then you would get the same folder name returned with the backslash removed:

JustPath ("C:\Microsoft Visual FoxPro 9\")


"C:\Microsoft Visual FoxPro 9"

Unlike the JustDrive() function, JustPath() will operate safely on network drives and on paths containing forward slashes:

JustPath ("\\ServerXP\Shipped\")

would return:



JustPath ("")

would return:


VBA equivalent

Microsoft Access does not have equivalents to these FoxPro file name commands so I wrote this library of Visual Basic functions to give me the same facilities in VBA.