Sorry I didn't get back to you earlier... One of the parameters of the <copy> task is the "overwrite" parameter. This will prevent a file from being copied over even if the file you're copying is a newer version. That won't fail the copy task, but it will prevent you from overwriting existing files.
A possibility is the AntContrib <foreach> task <http://ant-contrib.sourceforge.net/tasks/tasks/foreach.html> combined with the fail task which can fail on a condition. You can iterate over the list of files in what you're copying, and then check to see if that file already exists: <foreach target="file.exists.test" param="file.name"> <fileset dir="${copy.dir}"/> <foreach> <target name="file.exists.test"> <fail message="${file.name} already exists"> <condition> <available file="${file.name}" </condition> </target> On Mon, Jan 26, 2009 at 6:36 AM, Yves Dessertine <yvesd.pub...@gmail.com> wrote: > Hi there. > > It is possible with Ant to make a copy task fail if any destination > file already exists? > > I found no clue in the docs (noticed only the "failonerror" param in > copy task (http://ant.apache.org/manual/CoreTasks/copy.html) and in > the condition for the "fail" task, but nothing relevant IMHO). > > I know it would be possible to check the existance of an entire > folder, but this isn't suitable for my project. > > I'd appreciate any help. > > Thanks, > > Yves Dessertine > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@ant.apache.org > For additional commands, e-mail: user-h...@ant.apache.org > > -- -- David Weintraub qazw...@gmail.com --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@ant.apache.org For additional commands, e-mail: user-h...@ant.apache.org