This function renames an existing file or a directory—including all its children.
At a Glance
Header file: | Winbase.h |
Windows CE versions: | 1.0 and later |
Syntax
BOOL MoveFile(LPCTSTR lpExistingFileName, LPCTSTR lpNewFileNam);
Parameters
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. The new name must not already exist. A new file may be on a different file system or drive. A new directory must be on the same drive.
Return Values
Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError.
Remarks
The MoveFile function will move (rename) either a file or a directory (including all 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.
See Also