Ejemplo n.º 1
0
        public static void MoveDirectory(
            string sourceFolderPath,
            string destinationFolderPath)
        {
            sourceFolderPath      = CheckAddLongPathPrefix(sourceFolderPath);
            destinationFolderPath = CheckAddLongPathPrefix(destinationFolderPath);

            if (!PInvokeHelper.MoveFile(sourceFolderPath, destinationFolderPath))
            {
                // http://msdn.microsoft.com/en-us/library/ms681382(VS.85).aspx.

                var lastWin32Error = Marshal.GetLastWin32Error();
                throw new Win32Exception(
                          lastWin32Error,
                          string.Format(
                              Resources.ErrorMovingFolder,
                              lastWin32Error,
                              sourceFolderPath,
                              destinationFolderPath,
                              CheckAddDotEnd(new Win32Exception(lastWin32Error).Message)));
            }
        }