FoxPro ForcePath function

The VFP ForcePath() returns the filename with the specified path replacing any existing path.

For example:

ForcePath ("C:\Microsoft Visual FoxPro 9\vfp9.exe", "D:\")

would return

"D:\vfp9.exe"

This function is useful when you want to make a backup of a file in a new folder. You can use the GetDir fuction to ask the user for a new path then use ForcePath to add this to the file names that you want to copy.

Note that FoxPro will not check whether the path specified exists or even if it is a correctly formed path name.

VBA equivalent

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

MS Access technical tips

Visual FoxPro technical tips

General Tips

 

More tips from Alvechurch Data

FoxPro Functions

FoxPro has always had functions like FREAD and FWRITE to read and write files at a low level. They can handle files which defeat the STRTOFILE and FILETOSTR functions.

Read More

FoxPro DefaultExt function

FoxPro functions to manipulate names of files and folders

Read More

FoxPro ForceExt function

FoxPro functions to manipulate names of files and folders

Read More

FoxPro JustExt function

FoxPro functions to manipulate names of files and folders

Read More

FoxPro JustFName function

FoxPro functions to manipulate names of files and folders

Read More