movefileex (kernel32)
Last changed: -131.107.0.70

.
Summary

C# Signature:

[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("kernel32.dll", SetLastError=true, CharSet=CharSet.Unicode)]
static extern bool MoveFileEx(string lpExistingFileName, string lpNewFileName,
   MoveFileFlags dwFlags);

VB.Net Signature:

Declare Unicode Function MoveFileEx Lib "kernel32.dll" Alias "MoveFileExW" (ByVal lpExistingFileName As String, ByVal lpNewFileName As String, ByVal dwFlags As MoveFileFlags) As Integer

User-Defined Types:

MoveFileFlags

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

// Schedule to next restart dstFile delete and rename of srcFile to dstFile.
MoveFileEx(dstFile, null, MoveFileFlags.MOVEFILE_DELAY_UNTIL_REBOOT);
MoveFileEx(srcFile, dstFile, MoveFileFlags.MOVEFILE_DELAY_UNTIL_REBOOT);

Alternative Managed API:

File.Move is similar but without options.

Documentation
MoveFileEx on MSDN