[This is preliminary documentation and subject to change.]
Enables applications to move files and update link tracking information.
BOOL MoveFileWithProgress(
LPCTSTR lpExistingFileName, //Move source filename
LPCTSTR lpNewFileName, //Move destination filename
LPPROGRESS_ROUTINE lpProgressRoutine, //Progress routine
LPVOID lpData, //Parameters for progress routine
DWORD dwFlags //Flags
);
When moving a file, the destination can be on a different file system or drive. If the destination is on another drive, you must set the MOVEFILE_COPY_ALLOWED flag in dwFlags.
When moving a directory, the destination must be on the same drive.
If dwFlags specifies MOVEFILE_DELAY_UNTIL_REBOOT, lpNewFileName can be NULL. In this case, this function registers the lpExistingFileName file to be deleted when the system reboots.
Address of a callback function that is called each time another portion of the file has been moved. This parameter can be NULL. For more information on the progress callback function, see CopyProgressRoutine.
Flag | Meaning |
---|---|
MOVEFILE_REPLACE_EXISTING | If a file of the name specified by lpNewFileName already exists, the function replaces its contents with those specified by lpExistingFileName. |
MOVEFILE_COPY_ALLOWED | If the file is to be moved to a different volume, the function simulates the move by using the CopyFile and DeleteFile functions. Cannot be combined with the MOVEFILE_DELAY_UNTIL_REBOOT flag. |
MOVEFILE_DELAY_UNTIL_REBOOT | The function does not move the file until the operating system is restarted. The system moves the file immediately after AUTOCHK is executed, but before creating any paging files. Consequently, this parameter enables the function to delete paging files from previous startups. This flag can only be used if the process is in the context of a user who belongs to the administrator group or the LocalSystem account. |
MOVEFILE_WRITE_THROUGH | The function does not return until the file has actually been moved on the disk. Setting this flag guarantees that a move performed as a copy and delete operation is flushed to the disk before the function returns. The flush occurs at the end of the copy operation. This flag has no effect if the MOVEFILE_DELAY_UNTIL_REBOOT flag is set. |
MOVEFILE_CREATE_HARDLINK | TBD |
MOVEFILE_FAIL_IF_NOT_TRACKABLE | TBD |
If the function succeeds, the return value is TRUE. The source file must have been opened for write access for this call to succeed.
If the function fails, the return value is FALSE. To get extended error information, call GetLastError.
The MoveFileWithProgress function is equivalent to the MoveFileEx function, except that it takes an lpProgressRoutine parameter. This parameter is used exactly like its counterpart in the CopyFileEx function – it provides the caller an opportunity to monitor and control the progress of a move operation. The additional value of this function is that it coordinates with the link tracking service so that moved link sources can be tracked.
MoveFileWithProgress provides a superset of the capabilities of the MoveFile and MoveFileEx functions. All three of these functions coordinate with the link tracking service, so that link sources may be tracked as they are moved.
This function is supported only on Windows NT 5.0.
Windows NT: Use version 5.0 or later.
Windows: Unsupported.
Windows CE: Unsupported.
Header: Declared in winbase.h.
Import Library: Use kernel32.lib.