/// <summary> /// Copy the directory to the desktop folder /// </summary> /// <param name="CurrentDirectory">the current directory instant</param> /// <param name="copySubDirs">true to copy sub directory</param> /// <param name="overwriteFiles">true to overWrite existing files, by default set to false</param> /// <exception cref="UnauthorizedAccessException">The caller does not have the required permission.</exception> /// <exception cref="DirectoryNotFoundException">if the Directory not exist</exception> /// <exception cref="Security.SecurityException"> The caller does not have the required permission.</exception> /// <exception cref="PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. /// For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters.</exception> /// <exception cref="IOException">An error occurs, or the destination file already exists and overwrite is false.</exception> public static void CopyToDesktop(this DirectoryInfo CurrentDirectory, bool copySubDirs = true, bool overwriteFiles = false) { CurrentDirectory.Copy(DirectoriesHelper.GetDesktopPath()); }
/// <summary> /// move the folder to the desktop folder /// </summary> /// <param name="CurrentDirectory">directory to move</param> /// <exception cref="DirectoryNotFoundException">The Current directory cannot be found.</exception> /// <exception cref="IOException"> An attempt was made to move a directory to a different volume. /// -or- destDirName already exists. /// -or- You are not authorized to access this path. /// -or- The directory being moved and the destination directory have the same name.</exception> /// <exception cref="Security.SecurityException">The caller does not have the required permission.</exception> public static void MoveToDesktop(this DirectoryInfo CurrentDirectory) { CurrentDirectory.Move(DirectoriesHelper.GetDesktopPath()); }