>Does anyone know how to change a folder name from within a VFP program? I've been told that it can only be done through the Windows API. (Please provide an example. I'm not that familiar with the syntax when using the API.)
I'd recommend using the Scripting.FileSystemObject's MoveFolder method. This requires installation of the Windows Scripting Host's automation objects (you can download the WSH from Microsoft)
oFSO = CREATEOBJ('Scripting.FileSystemObject')
oFSO.MoveFolder("C:\Mydir\OldName","C:\MyDir\A New Name")
You can also do this with the Win32API call MoveFileEx:
DECLARE INTEGER MoveFileEx IN WIN32API ;
STRING @lpExistingFileName, ;
STRING @lpNewFileName, ;
INTEGER dwFlags
IF MoveFileEx("C:\OldDirName","C:\NewDirName",0) # 0
ELSE
ENDIF
Both the above are off the top of my head, so there may be typos. See the MSDN docs for exact syntax, flag values, restrictions, etc.