Wiki Home

Win 32 Api Move File


Namespace: VFP
Question:Is there a Win 32 API function to change the name of a Folder (Directory) programmatically ? Peter Somers

Yes - the MoveFile() API call will rename a file or folder:

DECLARE INTEGER MoveFile IN Win32API ;
   STRING @MyFileorFolderNameNow, ;
   STRING @TheNewNameIWant

CD C:\
MD FOO
IF MoveFile('FOO','BAR') > 0
   * it worked
ELSE
   * smoke
ENDIF
? DIRECTORY('BAR')  && it's there on my system at least


it's in the MSDN Platform SDK docs.
http://msdn.microsoft.com/library/psdk/winbase/filesio_4zqd.htm
Ed Rauh
Category Windows API
( Topic last updated: 2005.03.24 11:40:06 AM )