ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bevan Arps <bevan.a...@actfs.co.nz>
Subject Re: How to copy file only if file not present??
Date Thu, 11 Oct 2001 21:45:30 GMT
At 16:17 11/10/2001 -0500, you wrote:
>I want to copy a default property file from src to destination only if
>the file isn't already at destination.

If you know the exact name, use the Available task to set a property if the 
file is present, then use the unless attribute of a target to only copy if 
the file isn't there.

Something like this:

<target name="ensureDefaultProperties"
     depends="checkForDefaultProperties, copyDefaultProperties"/>

<target name="checkForDefaultProperties">
   <available "alreadyHaveDefaultProperties" 
file="deploy/defaults-constants.properties"/>
</target>

<target name="copyDefaultProperties" unless="alreadyHaveDefaultProperties">
   <copy file="src/defaults-constants.properties" 
tofile="deploy/defaults-constants.properties"/>
</target>

(This is untested so the usual warnings apply if you copy and paste this)

Hope this helps,
Bevan.



--
"Programming is an Art Form that Fights Back"

Bevan Arps (<mailto:bevan.arps@actfs.co.nz>bevan.arps@actfs.co.nz)
Senior OO Analyst, ACT Financial Systems

This communication  is confidential  to ACT  Financial  Systems  (Asia 
Pacific)  and is intended for  use only by the  addressee.   The  views and 
opinions  expressed in  this email  are the senders  own and do not 
represent  the  views  and  opinions of  ACT  Financial  Systems  (Asia 
Pacific).


Mime
View raw message