ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Glenn and Sarah McAllister" <>
Subject Re: cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs
Date Wed, 04 Oct 2000 07:46:24 GMT
Hey all.

Ok, the consolidated Copy, Move, and Delete tasks are on the shelf.  I
realize that some of the changes people have asked for since I first offered
the patch didn't make it, but I'll be looking at them soon.  I just wanted
to get something out the door when I had the chance.  Below is a (slightly
modified) snippet of message 4489, explaining how to use the tasks.

To encourage the use of these tasks, there are deprecation messages in
Copyfile, Copydir, Deltree, and Rename.  There is also a deprecation warning
if you use the implicit FileSet attributes in Delete.

Let me know if anyone has problems.

>> start here <<
One of the big wants for the next release of Ant is a consolidated set of
copy, move, and delete tasks.  For background, send an empty email to (thanks to Sefan for pointing the
thread out).

The biggest difference between these tasks and the current delete,
deltree, copyfile, and copydir tasks is that the fileset is _not_
implicit (with the exception of the delete task to keep every build file in
existance from breaking).

Copies a file or directory 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.

<copy file="some_file.txt" tofile="some_other_file.txt" />

<copy file="some_file.txt" todir="some/other/dir" />

<copy dir="src_dir" todir="../some/other/dir" />

<copy todir="../yet/another/dir">
  <fileset dir="src">
    <includes name="**/*.css" />
    <excludes name="**/*.html" />

<copy dir="src_dir"
      flatten="yes" />

Moves a file or directory to a new file or directory, or sets of files to
a new directory. By default, the destination file is overwritten if it
already exists. When overwrite is turned off, then files are only moved if
the source file is newer than the destination file, or when the
destination file does not exist.

<move file="file.orig" tofile="../moved/file.moved" />

Note that this effectively replaces the rename task.

<move file="file.orig" todir="../moved" />

<move dir="original/directory" todir="../directory/to/move/to" />

Note that the above move will actually remove the "directory" subdirectory
of "original".

<move todir="../directory/to/move/to">
  <fileset dir="original/dir" includes="**/*.css" />
  <fileset dir="original/otherdir" includes="**/*.html" />

<move dir="orig/dir" todir="../new/dir" filtering="yes" flatten="yes" />

Deletes either a single file, all files in a specified directory and its
sub-directories, or a set of files specified by a fileset.  When
specifying a set of files, empty directories are not removed.

<delete file="some/file/to/delete.txt" />

<delete dir="some/dir/to/delete" />

  <fileset dir="src/dir">
    <include name="**/*.bak" />
    <exclude name="**/really/important/backup.bak" />

<!-- Deprecated usage -->
<delete dir="src/dir">
  <include name="**/*.bak" />
  <exclude name="**/really/important/backup.bak" />

----- Original Message -----
From: <>
To: <>
Sent: Tuesday, October 03, 2000 9:34 PM
Subject: cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs

> glennm      00/10/03 21:34:02
>   Modified:    src/main/org/apache/tools/ant/taskdefs
>   Added:       src/main/org/apache/tools/ant/taskdefs
>   Log:
>   Consolidation of Copyfile, Copydir, Delete, Deltree, and Rename into
>   Copy, Move, and Delete tasks.

View raw message