ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [PATCH] Consolidated copy, move, and delete tasks
Date Fri, 08 Sep 2000 21:38:43 GMT
Hey all.

My applogies if this is coming to people as HTML (or with an HTML 
attachement).  I don't have control over how this gets sent out, so my 
appologies yet again.

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.  The drawback to this is that it breakes existing delete 
functionality.  The advantage is clarity and consistency in the use of 

I'm affraid I deleted the email where Conor explained how to include new 
files in a patch, so I'm affraid this is coming as three files - the patch 
for, index.html, and taskdefs/, and two new and files.

Comments, flames, kudos welcome.

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

Glenn McAllister
Software Developer. IBM Toronto Lab, (416) 448-3805
"An approximate answer to the right question is better than the 
right answer to the wrong question." - John W. Tukey
View raw message