/// <summary> /// Moves an existing file to a new location, providing the option to specify a new file name. /// </summary> /// <param name="env">The context.</param> /// <param name="filePath">The file path.</param> /// <param name="targetFilePath">The target file path.</param> /// <example> /// <code> /// MoveFile("test.tmp", "test.txt"); /// </code> /// </example> /// <exception cref="ArgumentNullException"><paramref name="env"/> or <paramref name="filePath"/> /// or <paramref name="targetFilePath"/> is <see langword="null"/></exception> /// <exception cref="FileNotFoundException">The target directory do not exist..</exception> /// <exception cref="InvalidOperationException">The file <paramref name="filePath.FullPath"/> do not exist. /// </exception> public static void MoveFile(this IFileSystemEnvironment env, FilePath filePath, FilePath targetFilePath) { FileMover.MoveFile(env, filePath, targetFilePath); }
/// <summary> /// Moves existing files matching the specified pattern to a new location. /// </summary> /// <param name="env">The context.</param> /// <param name="pattern">The pattern.</param> /// <param name="targetDirectoryPath">The target directory path.</param> /// <example> /// <code> /// MoveFiles("./publish/Cake.*", "./destination"); /// </code> /// </example> /// <exception cref="ArgumentNullException"><paramref name="env"/> or <paramref name="pattern"/> /// or <paramref name="targetDirectoryPath"/> is <see langword="null"/></exception> /// <exception cref="FileNotFoundException">The target directory do not exist.</exception> public static void MoveFiles(this IFileSystemEnvironment env, string pattern, DirectoryPath targetDirectoryPath) { FileMover.MoveFiles(env, pattern, targetDirectoryPath); }
/// <summary> /// Moves existing files to a new location. /// </summary> /// <param name="env">The context.</param> /// <param name="filePaths">The file paths.</param> /// <param name="targetDirectoryPath">The target directory path.</param> /// <example> /// <code> /// var files = GetFiles("./publish/Cake.*"); /// MoveFiles(files, "destination"); /// </code> /// </example> /// <exception cref="ArgumentNullException"><paramref name="env"/> or <paramref name="filePaths"/> /// or <paramref name="targetDirectoryPath"/> is <see langword="null"/></exception> /// <exception cref="FileNotFoundException">The target directory do not exist.</exception> /// <exception cref="InvalidOperationException">The directory <paramref name="targetDirectoryPath"/>.FullPath /// do not exist.</exception> public static void MoveFiles(this IFileSystemEnvironment env, IEnumerable <FilePath> filePaths, DirectoryPath targetDirectoryPath) { FileMover.MoveFiles(env, filePaths, targetDirectoryPath); }
/// <summary> /// Moves an existing file to a new location. /// </summary> /// <param name="env">The context.</param> /// <param name="filePath">The file path.</param> /// <param name="targetDirectoryPath">The target directory path.</param> /// <example> /// <code> /// MoveFileToDirectory("test.txt", "./targetdir"); /// </code> /// </example> /// <exception cref="ArgumentNullException"><paramref name="env"/> or <paramref name="filePath"/> /// or <paramref name="targetDirectoryPath"/> is <see langword="null"/></exception> /// <exception cref="FileNotFoundException">The target directory do not exist..</exception> public static void MoveFileToDirectory(this IFileSystemEnvironment env, FilePath filePath, DirectoryPath targetDirectoryPath) { FileMover.MoveFileToDirectory(env, filePath, targetDirectoryPath); }