From 9f766c7fa0d49087dcb5fa50dce049f275f3db54 Mon Sep 17 00:00:00 2001
From: glennm
Copies a file or directory to a new file or directory. Files are +
Copies a file or Fileset to a new file or directory. Files are only copied if the source file is newer than the destination file, or when the destination file does not exist. However, you can explicitly overwrite files with the overwrite attribute.
@@ -1192,19 +1192,15 @@ To use a fileset, the todir attribute must be set.Copy a directory to another directory
- <copy dir="src_dir" todir="../new/dir" /> + <copy todir="../new/dir"> + <fileset dir="src_dir"/> + </copy>
Copy a set of files to a directory
diff --git a/src/main/org/apache/tools/ant/taskdefs/Copy.java b/src/main/org/apache/tools/ant/taskdefs/Copy.java index 4873afaf6..3abb064d4 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Copy.java +++ b/src/main/org/apache/tools/ant/taskdefs/Copy.java @@ -74,7 +74,6 @@ import java.util.*; */ public class Copy extends Task { protected File file = null; // the source file - protected File dir = null; // the source directory protected File destFile = null; // the destination file protected File destDir = null; // the destination directory protected Vector filesets = new Vector(); @@ -93,13 +92,6 @@ public class Copy extends Task { this.file = file; } - /** - * Sets a directory to copy. - */ - public void setDir(File dir) { - this.dir = dir; - } - /** * Sets the destination file. */ @@ -176,16 +168,6 @@ public class Copy extends Task { } } - // deal with the directory - if (dir != null) { - DirectoryScanner ds = new DirectoryScanner(); - ds.setBasedir(dir); - ds.scan(); // include EVERYTHING - - String[] srcFiles = ds.getIncludedFiles(); - scan(dir, destDir, srcFiles); // add to fileCopyMap - } - // deal with the filesets for (int i=0; i0) { diff --git a/src/main/org/apache/tools/ant/taskdefs/Move.java b/src/main/org/apache/tools/ant/taskdefs/Move.java index afb66d140..a461a105b 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Move.java +++ b/src/main/org/apache/tools/ant/taskdefs/Move.java @@ -86,11 +86,6 @@ public class Move extends Copy { public void execute() throws BuildException { super.execute(); - - // take care of the source directory - if (dir != null && dir.exists()) { - deleteDir(dir); - } } //************************************************************************ @@ -139,7 +134,7 @@ public class Move extends Copy { } log("Deleting directory " + d.getAbsolutePath(), verbosity); if (!d.delete()) { - throw new BuildException("Unable to delete directory " + dir.getAbsolutePath()); + throw new BuildException("Unable to delete directory " + d.getAbsolutePath()); } }