ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Glenn and Sarah McAllister" <glenn.mcallis...@sympatico.ca>
Subject Re: cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs Copy.java Move.java Copydir.java Copyfile.java defaults.properties Delete.java Deltree.java Rename.java
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
ant-dev-thread.2332@jakarta-apache.org (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).

Copy
====
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" />
  </fileset>
</copy>

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

Move
====
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>

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

Delete
======
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" />

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

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


----- Original Message -----
From: <glennm@locus.apache.org>
To: <jakarta-ant-cvs@apache.org>
Sent: Tuesday, October 03, 2000 9:34 PM
Subject: cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs
Copy.java Move.java Copydir.java Copyfile.java defaults.properties
Delete.java Deltree.java Rename.java


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



Mime
View raw message