/// <exception cref="ArgumentNullException"><paramref name="env"/> or <paramref name="pattern"/> or /// is <see langword="null"/></exception> /// <exception cref="FileNotFoundException">The file does not exist.</exception> /// <exception cref="InvalidOperationException">The target directory does not exist.</exception> public static void CopyFiles(IFileSystemEnvironment env, string pattern, DirectoryPath targetDirectoryPath) { if (env == null) { throw new ArgumentNullException(nameof(env)); } if (pattern == null) { throw new ArgumentNullException(nameof(pattern)); } var files = env.GetFiles(pattern); if (files.Count == 0) { return; } CopyFiles(env, files, targetDirectoryPath); }
/// <exception cref="ArgumentNullException"><paramref name="env"/> or <paramref name="pattern"/> /// is <see langword="null"/></exception> /// <exception cref="FileNotFoundException">The file does not exist.</exception> /// <exception cref="InvalidOperationException">Cannot delete files when <paramref name="env.FS"/> is null. /// </exception> public static void DeleteFiles(IFileSystemEnvironment env, string pattern) { if (env == null) { throw new ArgumentNullException(nameof(env)); } if (pattern == null) { throw new ArgumentNullException(nameof(pattern)); } var files = env.GetFiles(pattern); if (files.Count == 0) { return; } DeleteFiles(env, files); }