Group: File Management - Library: kernel32
To specify how to move the file, use the MoveFileEx function
Creating a file, then moving it to another destination
BOOL MoveFile(
LPCTSTR lpExistingFileName, // file name
LPCTSTR lpNewFileName // new file name
);
DECLARE INTEGER MoveFile IN kernel32;
STRING lpExistingFileName,;
STRING lpNewFileName
lpExistingFileName [in] Pointer to a null-terminated string that names an existing file or directory
lpNewFileName [in] Pointer to a null-terminated string that specifies the new name of a file or directory
If the function succeeds, the return value is nonzero
MSDN: the MoveFile function will move (rename) either a file or a directory (including its children) either in the same directory or across directories.
The one caveat is that the MoveFile function will fail on directory moves when the destination is on a different volume -- use SHFileOperation instead.
See also: CopyFile, DeleteFile, MoveFileTransacted, SHFileOperation.