// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.Runtime.InteropServices; namespace E { public class MainClass { const int MOVEFILE_REPLACE_EXISTING = 1; const int MOVEFILE_COPY_ALLOWED = 2; const int MOVEFILE_DELAY_UNTIL_REBOOT = 4; const int MOVEFILE_WRITE_THROUGH = 8; [DllImport("kernel32.dll", SetLastError=true, CharSet=CharSet.Auto)] static extern bool MoveFileEx(string lpExistingFileName, string lpNewFileName, int dwFlags); public static void Main(string[] args) { MoveFileEx(@"C:\z.z", @"C:\z.3", MOVEFILE_REPLACE_EXISTING); } } }